diff --git a/ESLZ/front-door.tf b/ESLZ/front-door.tf index 588e70e..1c93a41 100644 --- a/ESLZ/front-door.tf +++ b/ESLZ/front-door.tf @@ -1,12 +1,13 @@ variable "front_doors" { type = any default = {} - description = "Value for run books. This is a collection of values as defined in runbook.tfvars" + description = "Front Doors to deploy" } module "front_door" { + source = "github.com/canada-ca-terraform-modules/terraform-azurerm-caf-front-door.git?ref=v1.0.2" + for_each = var.front_doors - source = "github.com/canada-ca-terraform-modules/terraform-azurerm-caf-front-door.git?ref=v1.0.1" env = var.env group = var.group project = var.project @@ -15,4 +16,5 @@ module "front_door" { resource_groups = local.resource_groups_all zones = local.zones origin_host_name = "example2.example.com" + tags = var.tags } \ No newline at end of file diff --git a/module.tf b/module.tf index ca00a4e..0107fdb 100644 --- a/module.tf +++ b/module.tf @@ -102,7 +102,7 @@ resource "azurerm_cdn_frontdoor_route" "route" { # Azure Front Door Custom Domains resource "azurerm_cdn_frontdoor_custom_domain" "custom_domain" { - for_each = var.front_door.custom_domains + for_each = try(var.front_door.custom_domains, {}) name = "${local.front-door-name}-${each.key}" cdn_frontdoor_profile_id = azurerm_cdn_frontdoor_profile.frontdoor_profile.id host_name = each.value.host_name @@ -131,7 +131,7 @@ resource "azurerm_cdn_frontdoor_custom_domain_association" "local_domain_associa # Azure Front Door Custom Domain Association resource "azurerm_cdn_frontdoor_custom_domain_association" "domain_association" { - for_each = var.front_door.custom_domains + for_each = try(var.front_door.custom_domains, {}) cdn_frontdoor_custom_domain_id = azurerm_cdn_frontdoor_custom_domain.custom_domain[each.key].id cdn_frontdoor_route_ids = [azurerm_cdn_frontdoor_route.route.id] } @@ -390,6 +390,7 @@ resource "azurerm_cdn_frontdoor_firewall_policy" "fd_firewall_policy" { resource "azurerm_cdn_frontdoor_security_policy" "fd_security_policy" { + count = try(var.front_door.custom_domains, {}) != {} ? 1 : 0 name = "${local.rule_set-name}securitypolicy" cdn_frontdoor_profile_id = azurerm_cdn_frontdoor_profile.frontdoor_profile.id