Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionals for application gateway backend pools #1542

Closed
PleaseStopAsking opened this issue Jul 11, 2018 · 2 comments
Closed

Conditionals for application gateway backend pools #1542

PleaseStopAsking opened this issue Jul 11, 2018 · 2 comments

Comments

@PleaseStopAsking
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

It would be helpful if there was a way to conditionally create certain arguments when using the application gateway resource. Specifically, I would like to be able to create additional backend_address_pool, probe, backend_http_settings and path_rule based on a true/false variable that I am also using to conditionally deploy extra servers behind the application gateway.

New or Affected Resource(s)

azurerm_application_gateway

Potential Terraform Configuration

resource "azurerm_application_gateway" "appGateway" {
 ...

  backend_address_pool {
    count = "${var.deployInfo["enableExtraServers"] == "true" ? 1 : 0}"
    name = "${var.extraServers["name"]}"
    ip_address_list = ["${var.extraServers["ip_address_list"]}"]
  }

  probe {
    count = "${var.deployInfo["enableExtraServers"] == "true" ? 1 : 0}"
    name = "${var.extraServers["name"]}"
    protocol = "Https"
    path = "${var.extraServers["healthCheckPath"]}"
    host = "127.0.0.1"
    interval  = 30
    timeout = 30
    unhealthy_threshold = 3
  }

  backend_http_settings {
    count = "${var.deployInfo["enableExtraServers"] == "true" ? 1 : 0}"
    name = "${var.extraServers["name"]}"
    cookie_based_affinity = "Disabled"
    port = 443
    protocol = "Https"
    request_timeout = 20
    probe_name = "${var.extraServers["name"]}"
    }
  }

  url_path_map {
    ...

    path_rule {
      count = "${var.deployInfo["enableExtraServers"] == "true" ? 1 : 0}"
      name = "${var.extraServers["name"]}"
      backend_address_pool_name = "${var.extraServers["name"]}"
      backend_http_settings_name = "${var.extraServers["name"]}"
      paths = ["/${var.extraServers["path"]}/*"]
    }
  }
}

References

@tombuildsstuff
Copy link
Contributor

hi @PleaseStopAsking

Thanks for opening this issue :)

Whilst this isn't possible today using Terraform 0.11 - I believe this may be possible with some of the changes coming in Terraform 0.12 later this summer (although using lists/the for_each attribute on nested resources vs the count attribute). The other option we're looking into here is if we can split this resource out as we have for the Load Balancer resource to create multiple resources - the API doesn't currently allow for this however there's an issue tracking this Feature Request here after which time this may be possible.

It's worth noting that we're currently blocked on an upstream issue in the Azure API that means we're holding off on enhancements to the Application Gateway resource; we're tracking that on our side in #1576 which I'm going to close this in favour of to allow us to keep track of this in a single place.

Thanks!

@ghost
Copy link

ghost commented Mar 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants