I’m trying to create an instance of Application Gateway. While doing so, I get the following error:
Error: creating Application Gateway: (Name "name-gateway-wgrkecswbk" / Resource Group "name03n62mct"): network.ApplicationGatewaysClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidResourceName" Message="Resource name is invalid. The name can be up to 80 characters long. It must begin with a word character, and it must end with a word character or with '_'. The name may contain word characters or '.', '-', '_'." Details=[]
The name used is name-gateway-wgrkecswbk
which, looks to be a valid name according the error description.
The location used is
with module.name.module.gateway[0].azurerm_application_gateway.res,
on .terraform/modules/name/modules/gateway/main.tf line 20, in resource "azurerm_application_gateway" "name":
20: resource "azurerm_application_gateway" "name" {
Tried removed dashes and making it shorter, with the same results.
2
Answers
The issue was that under
ssl_certificate
, thename
property was using a variablessl_certificate_name
which turned to beempty
.Then, the error coming back from
Azure
was half correct; It was an invalid name used, since it was an empty var, but not at the resource level (azurerm_application_gateway.name
), instead it was at the inner blockazurerm_application_gateway.name.ssl_certificate.name
level.Code:
Already reported this issue to Azure so hopefully it gets resolved soon.
Provider version was
3.37
The unicode character [i.e., space] on the gateway name may cause a problem. I have repeated the procedure using the same application gateway name, "name-gateway-wgrkecswbk."
below code reference from harshicop
main tf as follows:
provide tf as follows:
Output while running plan command
upon apply
From Portal: