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
Terraform (and AzureRM Provider) Version
Terraform v1.1.6
registry.terraform.io/hashicorp/azurerm v2.97.0
Affected Resource(s)
azurerm_application_gateway
Terraform Configuration Files
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_virtual_network" "example" {
name = "example-network"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
address_space = ["10.1.0.0/16"]
}
resource "azurerm_subnet" "frontend" {
name = "frontend"
resource_group_name = azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefixes = ["10.1.1.0/24"]
}
resource "azurerm_public_ip" "example" {
name = "example-pip"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
allocation_method = "Static"
sku = "Standard"
}
locals {
backend_address_pool_name = "devvnet-beap"
frontend_port_name = "devvnet-feport"
frontend_ip_configuration_name = "devvnet-feip"
http_setting_name = "devvnet-be-htst"
listener_name = "devvnet-httplstn"
request_routing_rule_name = "devvnet-rqrt"
redirect_configuration_name = "devvnet-rdrcfg"
}
resource "azurerm_application_gateway" "network" {
name = "example-appgateway"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
sku {
name = "WAF_v2"
tier = "WAF_v2"
}
autoscale_configuration {
min_capacity = "1"
max_capacity = "4"
}
gateway_ip_configuration {
name = "my-gateway-ip-configuration"
subnet_id = azurerm_subnet.frontend.id
}
frontend_port {
name = local.frontend_port_name
port = 80
}
frontend_ip_configuration {
name = local.frontend_ip_configuration_name
public_ip_address_id = azurerm_public_ip.example.id
private_ip_address = "10.1.1.10"
private_ip_address_allocation = "Static"
}
backend_address_pool {
name = local.backend_address_pool_name
}
backend_http_settings {
name = local.http_setting_name
cookie_based_affinity = "Disabled"
path = "/path1/"
port = 80
protocol = "Http"
request_timeout = 60
}
http_listener {
name = local.listener_name
frontend_ip_configuration_name = local.frontend_ip_configuration_name
frontend_port_name = local.frontend_port_name
protocol = "Http"
}
request_routing_rule {
name = local.request_routing_rule_name
rule_type = "Basic"
http_listener_name = local.listener_name
backend_address_pool_name = local.backend_address_pool_name
backend_http_settings_name = local.http_setting_name
}
}
Expected Behaviour
As per Microsoft docs, the Application Gateway v2 SKU supports static public IP addresses and static internal IPs.
Link - https://docs.microsoft.com/en-us/azure/application-gateway/application-gateway-faq#does-application-gateway-support-static-ip
The Provided Static Private IP from the Virtual Network should be assigned to the frontend IP Configuration of the Application Gateway Resource with WAFv2 SKU.
Actual Behaviour
azurerm_application_gateway.network: Creating...
azurerm_application_gateway.network: Still creating... [10s elapsed]
| Error: creating/updating Application Gateway: (Name "example-appgateway" / Resource Group "example-resources"):
| network.ApplicationGatewaysClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error:
| Code="ApplicationGatewayFrontendIpCannotHavePublicIpAndPrivateIp" Message="FrontendIpConfiguration
| /subscriptions/******/resourceGroups/example-resources/providers/Microsoft.Network/applicationGateways/example-appgateway/frontendIPConfigurations/devvnet-feip cannot have both PublicIp and PrivateIpAddress. Only one should be specified." Details=[]
Steps to Reproduce
terraform apply
Community Note
Terraform (and AzureRM Provider) Version
Terraform v1.1.6
registry.terraform.io/hashicorp/azurerm v2.97.0
Affected Resource(s)
azurerm_application_gatewayTerraform Configuration Files
Expected Behaviour
As per Microsoft docs, the Application Gateway v2 SKU supports static public IP addresses and static internal IPs.
Link - https://docs.microsoft.com/en-us/azure/application-gateway/application-gateway-faq#does-application-gateway-support-static-ip
The Provided Static Private IP from the Virtual Network should be assigned to the frontend IP Configuration of the Application Gateway Resource with WAFv2 SKU.
Actual Behaviour
Steps to Reproduce
terraform apply