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

azurerm_application_gateway - http_listener host_names result in Azure listener warnings #6779

Closed
marius-udubasa opened this issue May 5, 2020 · 3 comments

Comments

@marius-udubasa
Copy link

I was using the recent http_listener host_names feature in the 2.8 azurerm provider: PR
It works, but in the end the behavior in the Azure portal is like this:

  • the App Gw Listeners entries no longer have a value on the Host name column.
  • clicking on such a Listener entry will display a warning that This Basic HTTP listener cannot use the same frontend port as an existing listener.
  • and in the bottom side of that edit pane for the Listener, the option for Listener type is switched to Basic, as opposed before the update when it was set to Multi site
  • the value for Host name is also missing, since it is only available under Multi site

The App Gw module I'm using is very similar with the one from here: dfar-io/terraform-azurerm-app-gateway

with a

  dynamic "http_listener" {
    for_each = var.https_listeners
    content {
      name                           = http_listener.value.name
      frontend_ip_configuration_name = local.frontend_ip_configuration_name
      frontend_port_name             = http_listener.value.is_https ? "https-port" : "http-port"
      protocol                       = http_listener.value.is_https ? "Https" : "Http"
      ssl_certificate_name           = http_listener.value.ssl_certificate_name
      host_names                     = http_listener.value.host_names
    }
  }

and

  dynamic "backend_http_settings" {
    for_each = var.backend_http_settings
    content {
      name                  = backend_http_settings.value.name
      cookie_based_affinity = backend_http_settings.value.has_cookie_based_affinity ? "Enabled" : "Disabled"
      path                  = backend_http_settings.value.path
      port                  = backend_http_settings.value.port
      protocol              = backend_http_settings.value.is_https ? "Https" : "Http"
      request_timeout       = backend_http_settings.value.request_timeout
      probe_name            = backend_http_settings.value.probe_name
      host_name             = backend_http_settings.value.host_name
    }
  }

resource definitions inside azurerm_application_gateway

And these variables in the module call:

  http_listeners = [
    {
      name       = "wp-80-listen"
      is_https   = false
      host_names = ["example.com", "www.example.com"]
    }
  ] 
...
    backend_http_settings = [
    {
      name                      = "wp-sett-80"
      has_cookie_based_affinity = false
      path                      = ""
      port                      = 80
      is_https                  = false
      request_timeout           = 20
      probe_name                = "wp-hc-80"
      host_name                 = "example.ro"
    }
  ]

My concern is that it might at some point send the wrong Host: header to one of the backends. Since I have more that one.
And also that I will be unable to make quick changes from the web portal if needed, since the current error/warning will prevent me from saving that edit pane.

@neil-yechenwei
Copy link
Contributor

neil-yechenwei commented May 6, 2020

Thanks for opening this issue.

  1. After tested, seems host_name in tfconfig maps to "host name" column in azure portal but host_names doesn't map to this column. So it doesn't show in this column.
  2. Seems "http listener" is associated with "host names" according by below response from rest api. So I assume your concern should have been handled by API.

So would you ok to close this issue for now? Feel free to reopen it if you run into it again. Thank you.

The response of getting application gateway:

{
  ......
  "properties": {
    ......
    "httpListeners": [
      {
        ......
        "properties": {
          ......
          "hostNames": [
            "testdns-123"
          ],
          ......
        },
        ......
      }
    ],
    ......
  }
}

Related reference:
https://docs.microsoft.com/en-us/azure/application-gateway/application-gateway-components#types-of-listeners

@marius-udubasa
Copy link
Author

Hi, (sorry for the late response) Yes, you are right, the template for that resource has the proper definition in the end. Only the web portal shows that error. And, sadly, for that reason I had to revert to host_name instead of host_names.

@ghost
Copy link

ghost commented Jun 27, 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 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Jun 27, 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

3 participants