Skip to content

Commit

Permalink
Merge pull request #68 from Azure/e-20
Browse files Browse the repository at this point in the history
Better Front Door and Private Link integration due to module outputs
  • Loading branch information
jiaweitao001 authored Nov 18, 2024
2 parents 8075ed0 + 4d6fac4 commit 8822ffa
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,6 @@ No modules.
| <a name="output_container_app_fqdn"></a> [container\_app\_fqdn](#output\_container\_app\_fqdn) | The FQDN of the Container App's ingress. |
| <a name="output_container_app_identities"></a> [container\_app\_identities](#output\_container\_app\_identities) | The identities of the Container App, key is Container App's name. |
| <a name="output_container_app_ips"></a> [container\_app\_ips](#output\_container\_app\_ips) | The IPs of the Latest Revision of the Container App. |
| <a name="output_container_app_uri"></a> [container\_app\_uri](#output\_container\_app\_uri) | The URI of the Container App's ingress. |
| <a name="output_default_domain"></a> [default\_domain](#output\_default\_domain) | The default domain of the Container App Environment. |
<!-- END_TF_DOCS -->
6 changes: 6 additions & 0 deletions examples/acr/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
output "app_url" {
value = module.container_apps.container_app_uri
}
output "app_fqdn" {
value = module.container_apps.container_app_fqdn
}
output "default_domain" {
value = module.container_apps.default_domain
}
2 changes: 1 addition & 1 deletion examples/existing-env/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
output "dashboard_url" {
value = module.container_apps.container_app_fqdn["dashboard"]
value = module.container_apps.container_app_uri["dashboard"]
}
2 changes: 1 addition & 1 deletion examples/init-container/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
output "url" {
value = module.container_apps.container_app_fqdn["example"]
value = module.container_apps.container_app_uri["example"]
}
2 changes: 1 addition & 1 deletion examples/startup/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
output "dashboard_url" {
value = module.container_apps.container_app_fqdn["dashboard"]
value = module.container_apps.container_app_uri["dashboard"]
}
2 changes: 2 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
locals {
container_app_secrets = { for k, v in var.container_app_secrets : k => { for i in v : i.name => i } }
dapr_component_secrets = { for k, v in var.dapr_component_secrets : k => { for i in v : i.name => i.value } }
fqdns = { for name, container in azurerm_container_app.container_app : name => try(container.ingress[0].fqdn, "") if can(container.ingress[0].fqdn) }
uris = { for name, fqdn in local.fqdns : name => "https://${fqdn}" }
}
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
locals {
container_app_environment_id = try(data.azurerm_container_app_environment.container_env[0].id, azurerm_container_app_environment.container_env[0].id)
container_app_environment_default_domain = try(data.azurerm_container_app_environment.container_env[0].default_domain, azurerm_container_app_environment.container_env[0].default_domain)
container_app_environment_id = try(data.azurerm_container_app_environment.container_env[0].id, azurerm_container_app_environment.container_env[0].id)
container_app_environment_static_ip_address = try(azurerm_container_app_environment.container_env[0].static_ip_address, data.azurerm_container_app_environment.container_env[0].static_ip_address)
}

resource "azurerm_log_analytics_workspace" "laws" {
Expand Down
14 changes: 12 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ output "container_app_environment_id" {

output "container_app_fqdn" {
description = "The FQDN 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) }
value = local.fqdns
}

output "container_app_identities" {
Expand All @@ -20,5 +20,15 @@ output "container_app_identities" {

output "container_app_ips" {
description = "The IPs of the Latest Revision of the Container App."
value = try(azurerm_container_app_environment.container_env[0].static_ip_address, data.azurerm_container_app_environment.container_env[0].static_ip_address)
value = local.container_app_environment_static_ip_address
}

output "container_app_uri" {
description = "The URI of the Container App's ingress."
value = local.uris
}

output "default_domain" {
description = "The default domain of the Container App Environment."
value = local.container_app_environment_default_domain
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ terraform {
version = ">= 3.98, < 4.0"
}
}
}
}

0 comments on commit 8822ffa

Please sign in to comment.