diff --git a/azurerm/resource_arm_application_gateway.go b/azurerm/resource_arm_application_gateway.go index 4e73a4af1f35..ae1534f93b54 100644 --- a/azurerm/resource_arm_application_gateway.go +++ b/azurerm/resource_arm_application_gateway.go @@ -179,7 +179,7 @@ func resourceArmApplicationGateway() *schema.Resource { "frontend_ip_configuration": { Type: schema.TypeList, - Optional: true, + Required: true, MinItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -304,7 +304,7 @@ func resourceArmApplicationGateway() *schema.Resource { "request_timeout": { Type: schema.TypeInt, - Required: true, + Optional: true, }, "authentication_certificate": { @@ -1593,6 +1593,11 @@ func flattenApplicationGatewayRequestRoutingRules(rules *[]network.ApplicationGa listener["backend_http_settings_id"] = *config.ApplicationGatewayRequestRoutingRulePropertiesFormat.BackendHTTPSettings.ID } + if config.ApplicationGatewayRequestRoutingRulePropertiesFormat.URLPathMap != nil { + listener["url_path_map_name"] = id.Path["urlPathMap"] + listener["url_path_map_id"] = *config.ApplicationGatewayRequestRoutingRulePropertiesFormat.URLPathMap.ID + } + result = append(result, listener) } diff --git a/website/docs/r/application_gateway.html.markdown b/website/docs/r/application_gateway.html.markdown index 820b9da910aa..d300d8cd2000 100644 --- a/website/docs/r/application_gateway.html.markdown +++ b/website/docs/r/application_gateway.html.markdown @@ -10,9 +10,6 @@ description: |- Creates a new application gateway based on a previously created virtual network with configured subnets. -~> **NOTE on Application Gateways:** TODO - Investigate routing rules and url path maps. -Sample reference format: [Subnet resource](subnet.html) TODO - other reference needed. - ## Example Usage ```hcl @@ -69,17 +66,17 @@ resource "azurerm_application_gateway" "network" { } frontend_port { - name = "my-frontend-port" + name = "${azurerm_virtual_network.vnet.name}-feport" port = 80 } frontend_ip_configuration { - name = "my-frontend-ip-configuration" + name = "m${azurerm_virtual_network.vnet.name}-feip" public_ip_address_id = "${azurerm_public_ip.pip.id}" } backend_address_pool { - name = "my-backend-address-pool" + name = "${azurerm_virtual_network.vnet.name}-beap" } backend_http_settings { @@ -126,7 +123,7 @@ The following arguments are supported: * `frontend_port` - (Required) Front-end port for the application gateway. The `frontend_port` block supports fields documented below. -* `frontend_ip_configuration` - (Optional) Specifies lists of frontend IP configurations. Currently only one Public and/or one Private IP address can be specified. Also one frontendIpConfiguration element can specify either Public or Private IP address, not both. The `frontend_ip_configuration` block supports fields documented below. +* `frontend_ip_configuration` - (Required) Specifies lists of frontend IP configurations. Currently only one Public and/or one Private IP address can be specified. Also one frontendIpConfiguration element can specify either Public or Private IP address, not both. The `frontend_ip_configuration` block supports fields documented below. * `backend_address_pool` - (Required) Backend pools can be composed of NICs, virtual machine scale sets, public IPs, internal IPs, fully qualified domain names (FQDN), and multi-tenant back-ends like Azure Web Apps. Application Gateway backend pool members are not tied to an availability set. Members of backend pools can be across clusters, data centers, or outside of Azure as long as they have IP connectivity. The `backend_address_pool` block supports fields documented below. @@ -148,8 +145,6 @@ The following arguments are supported: * `disabled_ssl_protocols` - TODO - based on "sslPolicy": {"disabledSslProtocols": []} -TODO - what makes block fields optional/required? - The `sku` block supports: * `name` - (Required) Supported values are: @@ -182,7 +177,6 @@ The `frontend_ip_configuration` block supports: * `name` - (Required) User defined name for a frontend IP configuration. * `subnet_id` - (Optional) Reference to a Subnet. -TODO - where is this in Azure? * `private_ip_address` - (Optional) Private IP Address. @@ -344,8 +338,7 @@ The following attributes are exported: application gateways can be imported using the `resource id`, e.g. ``` -TODO - correct this -terraform import azurerm_virtual_network.testNetwork /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1 + +terraform import azurerm_application_gateway.testApplicationGateway /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/applicationGateways/myGateway1 + ``` - -TODO - Application Gateway attribute cross reference mechanism in HCL?