Hi,
I have been trying to automate creation of Application Gateway V2 (with WAF_v2) by following the documentation https://www.terraform.io/docs/providers/azurerm/r/application_gateway.html
Surely there are few references to V2 so i am assuming that the documentation has been updated after the new App gateway V2 release.
My problem is with regards to the “Backend_http_Settings” which i am trying to configure to use the “trusted root certificate” using below syntax:
backend_http_settings {
name = "${local.http_setting_name}"
cookie_based_affinity = "Disabled"
port = 443
protocol = "Https"
request_timeout = 30
host_name = "XXX-qa.test.com"
authentication_certificate{
name = "${local.trusted_root_certificate_name}"
}
}
In the above code block i have defined the authentication_certificate sub section so that i can link the backend_http_settings with a trusted_root_certificate that is being created in the same application gateway resource code block. This successfully passes the “terraform plan” however when i try to “apply” the change, it fails with below error:
Error: Code=“InvalidResourceReference” Message=“Resource XXXX/providers/Microsoft.Network/applicationGateways/XXXX/authenticationCertificates/XXXX-test-vnet-trc referenced by resource XXXX/providers/Microsoft.Network/applicationGateways/XXXX-test-agwv1/backendHttpSettingsCollection/XXXX-test-vnet-be-htst was not found. Please make sure that the referenced resource exists, and that both resources are in the same region.” Details=
If I remove the “authentication_certificate” sub section from the above code, it works fine however it creates the Http Listner but with “Use Well Known CA Certificate” option selected.
Is there any configuration that i am missing to set correctly so that i can link the certificate for the trusted root?
Thanks!