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

Support for Multi-site Listeners on Application Gateway #2102

Closed
Phydeauxman opened this issue Oct 17, 2018 · 3 comments
Closed

Support for Multi-site Listeners on Application Gateway #2102

Phydeauxman opened this issue Oct 17, 2018 · 3 comments

Comments

@Phydeauxman
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

Multi-site listeners are created on an Azure Application Gateway in order to host multiple websites on the same IP/Port. Currently, the azurerm_application_gateway resource only supports creating listeners of type Basic.

New or Affected Resource(s)

  • azurerm_application_gateway

Potential Terraform Configuration

resource "azurerm_application_gateway" "appgw" {
  name                = "${var.appgw_name}"
  location            = "${data.terraform_remote_state.rg.rglocation}"
  resource_group_name = "${data.terraform_remote_state.rg.rgname}"

  sku {
    name     = "WAF_Medium"
    tier     = "WAF"
    capacity = 2
  }

  gateway_ip_configuration {
    name      = "AppGW-ip-configuration"
    subnet_id = "${data.terraform_remote_state.rg.vnetid}/subnets/${data.terraform_remote_state.rg.sn1name}"
  }

  frontend_port {
    name = "${data.terraform_remote_state.rg.vnetname}-feport"
    port = 80
  }

  frontend_ip_configuration {
    name                 = "${data.terraform_remote_state.rg.vnetname}-feip"
    public_ip_address_id = "${azurerm_public_ip.pip.id}"
  }

  # App1 Listener
  http_listener {
    name                           = "${var.ui_listener_name}"
    frontend_ip_configuration_name = "${data.terraform_remote_state.rg.vnetname}-feip"
    frontend_port_name             = "${data.terraform_remote_state.rg.vnetname}-feport"
    protocol                       = "HTTP"
  }

  # App2 Listener
  http_listener {
    name                           = "${var.hd_listener_name}"
    frontend_ip_configuration_name = "${data.terraform_remote_state.rg.vnetname}-feip"
    frontend_port_name             = "${data.terraform_remote_state.rg.vnetname}-feport"
    protocol                       = "HTTP"
  }

  # Configuration for API web app
  backend_address_pool {
    name            = "${var.apiapp_name}-beap"
    fqdn_list       = ["${var.apiapp_name}.${data.terraform_remote_state.rg.privateDnsZone}"]
  }

  probe {
    name                = "${var.apiapp_name}-probe"
    path                = "/"
    protocol            = "Http"
    host                = "${var.apiapp_name}.${data.terraform_remote_state.rg.privateDnsZone}"
    interval            = 30
    timeout             = 30
    unhealthy_threshold = 3
  }

  backend_http_settings {
    name                  = "${var.apiapp_name}"
    cookie_based_affinity = "Disabled"
    port                  = "${var.apiapp_port}"
    protocol              = "Http"
    request_timeout       = 30
    probe_name            = "${var.apiapp_name}-probe"
  }

  # Configuration for App1 web app
  backend_address_pool {
    name            = "${var.uiapp_name}-beap"
    fqdn_list       = ["${var.uiapp_name}.${data.terraform_remote_state.rg.privateDnsZone}"]
  }

  probe {
    name                = "${var.uiapp_name}-probe"
    path                = "/"
    protocol            = "Http"
    host                = "${var.uiapp_name}.${data.terraform_remote_state.rg.privateDnsZone}"
    interval            = 30
    timeout             = 30
    unhealthy_threshold = 3
  }

  backend_http_settings {
    name                  = "${var.uiapp_name}"
    cookie_based_affinity = "Disabled"
    port                  = "${var.uiapp_port}"
    protocol              = "Http"
    request_timeout       = 30
    probe_name            = "${var.uiapp_name}-probe"
  }

  request_routing_rule {
    name                       = "${var.rule_name}"
    rule_type                  = "PathBasedRouting"
    http_listener_name         = "${var.ui_listener_name}"
    backend_address_pool_name  = "${data.terraform_remote_state.ase.asename}-beap"
    backend_http_settings_name = "${var.uiapp_name}"
    url_path_map_name          = "${var.rule_name}"
  }

  url_path_map {
    name = "${var.rule_name}"
    default_backend_address_pool_name = "${var.uiapp_name}-beap"
    default_backend_http_settings_name = "${var.uiapp_name}"

    path_rule {
      name = "${var.apiapp_name}"
      paths = ["/api*"]
      backend_address_pool_name = "${var.apiapp_name}-beap"
      backend_http_settings_name = "${var.apiapp_name}"
    }
  }

  # WAF Configuration
  waf_configuration {
    enabled          = "true"
    firewall_mode    = "Detection"
    rule_set_type    = "OWASP"
    rule_set_version = "3.0"
  }
}

References

@Phydeauxman
Copy link
Author

Discovered that support already exists by using the optional host_name property. Documentation should be updated to reflect this.

@tombuildsstuff
Copy link
Contributor

This'll be fixed as a part of #2054

@tombuildsstuff tombuildsstuff added this to the 1.19.0 milestone Nov 12, 2018
@ghost
Copy link

ghost commented Mar 6, 2019

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 6, 2019
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