If you created your container app using azapi provider like below
resource "azapi_resource" "containerapp" {
type = "Microsoft.App/containerapps@2022-03-01"
name = var.aca_name
parent_id = azurerm_resource_group.rg.id
location = azurerm_resource_group.rg.location
identity {
type = "SystemAssigned, UserAssigned"
identity_ids = [azurerm_user_assigned_identity.containerapp.id]
}
body = jsonencode({
properties = {
managedEnvironmentId = azapi_resource.containerapp_environment.id
configuration = {
ingress = {
external : true,
targetPort : 80
},
"registries" : [
{
"server" : data.azurerm_container_registry.acr.login_server,
"identity" : azurerm_user_assigned_identity.containerapp.id
}
]
}
template = {
containers = [
{
image = "${data.azurerm_container_registry.acr.login_server}/aspcoresample:76ef8d9511d310649729a28563fdf6d133338e30",
name = "firstcontainerappacracr"
resources = {
cpu = 0.25
memory = "0.5Gi"
},
"probes" : [
{
"type" : "Liveness",
"httpGet" : {
"path" : "/",
"port" : 80,
"scheme" : "HTTP"
},
"periodSeconds" : 10
},
{
"type" : "Readiness",
"httpGet" : {
"path" : "/",
"port" : 80,
"scheme" : "HTTP"
},
"periodSeconds" : 10
},
{
"type" : "Startup",
"httpGet" : {
"path" : "/",
"port" : 80,
"scheme" : "HTTP"
},
"periodSeconds" : 10
}
]
}
]
scale = {
minReplicas = 0,
maxReplicas = 2
}
}
}
})
ignore_missing_property = true
depends_on = [
azapi_resource.containerapp_environment
]
}
then you have to add response_export_values = ["properties.configuration.ingress.fqdn"]
at the root level of the resource.
So next you can fetch fqdn
locals {
containerapp_fqdn = jsondecode(azapi_resource.containerapp.output).properties.configuration.ingress.fqdn
}