Terraform Version: 0.10.8
Affected Resource(s): Azurerm Application gateway
In the request_routing_rule block, can you please add support for redirectConfiguration? (That's the Azurerm json label) We would like to create HTTP to HTTPS redirect rules.
This feature was added to Azure App Gateways in July 2017:
https://docs.microsoft.com/en-us/azure/application-gateway/application-gateway-configure-redirect-powershell
馃憢
To give an update here: we're still waiting for the Application Gateway API to be fixed before proceeding with any enhancements or bug fixes for this resource; once the API is fixed (I've just requested an update). As such I've de-prioritised this issue for the moment, but we'll circle around and take another look once the API's in a usable state - sorry for the inconvenience here!
Thanks!
hi @kha7
Given this issue is blocked on an upstream issue in the Azure API rather than keeping multiple issues open and trying to ensure they all remain up to date - I'm going to close this in favour of #1576 which is the Meta-Issue tracking the Bugs and Enhancements for the Application Gateway Resource. Once the bug in the API is fixed we should be able to take a look into this, but we'll keep track of the status of this issue there for the moment.
Thanks!
Could this be a work around until this new feature is released?
resource "azurerm_public_ip" "app-gw-pip" {
name = "${azurerm_resource_group.k8s.name}-apw-pip"
location = "${azurerm_resource_group.k8s.location}"
resource_group_name = "${azurerm_resource_group.k8s.name}"
public_ip_address_allocation = "Dynamic"
}
resource "azurerm_application_gateway" "app-gw-k8s" {
name = "${azurerm_virtual_network.k8s_vnet.name}-apw"
location = "${azurerm_resource_group.k8s.location}"
resource_group_name = "${azurerm_resource_group.k8s.name}"
sku {
name = "Standard_Small"
tier = "Standard"
capacity = 2
}
gateway_ip_configuration {
name = "${azurerm_virtual_network.k8s_vnet.name}-gwip-cfg"
subnet_id = "${azurerm_virtual_network.k8s_vnet.id}/subnets/${azurerm_subnet.k8s_gw_subnet.name}"
}
ssl_certificate {
name = "${azurerm_virtual_network.k8s_vnet.name}-ssl"
data = "${base64encode(file("cert/public.pfx"))}"
password = "test1234"
}
frontend_port {
name = "${azurerm_virtual_network.k8s_vnet.name}-feport-http"
port = 80
}
frontend_port {
name = "${azurerm_virtual_network.k8s_vnet.name}-feport-https"
port = 443
}
frontend_ip_configuration {
name = "${azurerm_virtual_network.k8s_vnet.name}-feip"
public_ip_address_id = "${azurerm_public_ip.app-gw-pip.id}"
}
backend_address_pool {
name = "${azurerm_virtual_network.k8s_vnet.name}-beap"
# ip_address_list = ["${element(azurerm_network_interface.app-gw-nic.*.private_ip_address, count.index)}"]
ip_address_list = ["172.16.1.7"]
}
backend_http_settings {
name = "${azurerm_virtual_network.k8s_vnet.name}-be-htst"
cookie_based_affinity = "Disabled"
port = 80
protocol = "Http"
request_timeout = 1
}
// As there is not support for redirecction rules in Azure for terraform yet. HTTPS is the only listener configured
http_listener {
name = "${azurerm_virtual_network.k8s_vnet.name}-httplstn-http"
frontend_ip_configuration_name = "${azurerm_virtual_network.k8s_vnet.name}-feip"
frontend_port_name = "${azurerm_virtual_network.k8s_vnet.name}-feport-http"
protocol = "Http"
}
# request_routing_rule {
# name = "${azurerm_virtual_network.k8s_vnet.name}-rqrt"
# rule_type = "Basic"
# http_listener_name = "${azurerm_virtual_network.k8s_vnet.name}-httplstn"
# backend_address_pool_name = "${azurerm_virtual_network.k8s_vnet.name}-beap"
# backend_http_settings_name = "${azurerm_virtual_network.k8s_vnet.name}-be-htst"
# }
http_listener {
name = "${azurerm_virtual_network.k8s_vnet.name}-httplstn-https"
frontend_ip_configuration_name = "${azurerm_virtual_network.k8s_vnet.name}-feip"
frontend_port_name = "${azurerm_virtual_network.k8s_vnet.name}-feport-https"
protocol = "Https"
ssl_certificate_name = "${azurerm_virtual_network.k8s_vnet.name}-ssl"
}
request_routing_rule {
name = "${azurerm_virtual_network.k8s_vnet.name}-rqrt"
rule_type = "Basic"
http_listener_name = "${azurerm_virtual_network.k8s_vnet.name}-httplstn-https"
backend_address_pool_name = "${azurerm_virtual_network.k8s_vnet.name}-beap"
backend_http_settings_name = "${azurerm_virtual_network.k8s_vnet.name}-be-htst"
}
depends_on = [ "null_resource.deploy_echoserver" ]
}
// As there is not support for redirecction rules in Azure for terraform yet. HTTPS is the only listener configured
resource "null_resource" "config_redirect_rule_http_to_https" {
provisioner "local-exec" {
command = "az network application-gateway redirect-config create --gateway-name ${azurerm_application_gateway.app-gw-k8s.name} --name ${azurerm_virtual_network.k8s_vnet.name}-rcfg-http-to-https --resource-group ${azurerm_resource_group.k8s.name} --type Permanent --target-listener ${azurerm_virtual_network.k8s_vnet.name}-httplstn-https"
}
lifecycle {
ignore_changes = ["provisioner"]
}
}
This API has since been fixed, any idea when this will be implemented?
Once the bug in the API is fixed we should be able to take a look into this, but we'll keep track of the status of this issue [in #1576] for the moment.
@tombuildsstuff: I'm confused; please shed some light? If a solution is still pending, which ticket should I be watching? Alternatively, if a solution has been implemented, where is the documentation?
Is this functionality going to be available in near future
This feature request is being tracked in #1576 - rather than trying to track the conversations across multiple issues since this issue is closed I'm going to lock this issue for the moment; please subscribe to #1576 for updates