One of my Azure Terraform deployments recently started failing with “unsupported attribute”. The deployment involves container app environments which aren’t currently supported by azurerm, so I’m working around that with azapi [AZAPI]. The template references an attribute (“staticIp” for the interested reader) in the resource creation JSON output. The deployment started breaking in early January 2023 with an error “unsupported attribute: properties.staticIp” which is strange, because the output JSON includes the property.
The workaround here is to obtain an azapi data source [AZDS] and read the property from there.
data "azapi_resource" "containerapp-env-ref" {
name = azapi_resource.containerapp_environment.name
parent_id = azurerm_resource_group.rg.id
type = "Microsoft.App/managedEnvironments@2022-03-01"
response_export_values = ["properties.staticIp"]
}
resource "azurerm_private_dns_a_record" "containerapp_record" {
name = azapi_resource.containerapp.name
zone_name = azurerm_private_dns_zone.dns-zone.name
resource_group_name = azurerm_resource_group.rg.name
ttl = 300
records = ["${jsondecode(data.azapi_resource.containerapp-env-ref.output).properties.staticIp}"]
depends_on = [
data.azapi_resource.containerapp-env-ref
]
}
References
[AZAPI] https://registry.terraform.io/providers/azure/azapi/latest/docs
[AZCAE] https://learn.microsoft.com/en-us/azure/container-apps/environment
[AZDS] https://registry.terraform.io/providers/Azure/azapi/latest/docs/data-sources/azapi_resource