Azure / terraform-azure-container-apps

A Terraform module to deploy a container app in Azure
https://github.com/Azure/terraform-azure-container-apps
35 stars 22 forks source link

Support for container_app_fqdn and default_domain #21

Open icklsede opened 10 months ago

icklsede commented 10 months ago

Is there an existing issue for this?

Description

To use this module with Azure Front Door and Private Link Service, I need the default_domain of the Container App Environment and the FQDN of the Container App's internal service domain.

The current output is a full URI (with https://), which is not usable in the context of Front Door. So I suggest to change the output container_app_fqdn to a value with FQDN and adding another output container_app_uri with the full URI as value.

New or Affected Resource(s)/Data Source(s)

azurerm_container_app_environment, azurerm_container_app.container_app

Potential Terraform Configuration

output "default_domain" {
  description = "The default domain of the Container App Environment."
  value       = azurerm_container_app_environment.container_env.default_domain
}

output "container_app_fqdn" {
  description = "The FQDN of the Container App's ingress."
  value       = { for name, container in azurerm_container_app.container_app : name => "${try(container.ingress[0].fqdn, "")}" if can(container.ingress[0].fqdn) }
}

output "container_app_uri" {
  description = "The URI of the Container App's ingress."
  value       = { for name, container in azurerm_container_app.container_app : name => "https://${try(container.ingress[0].fqdn, "")}" if can(container.ingress[0].fqdn) }
}

References

No response