Skip to content

Commit

Permalink
Custom domains now optional, added tags in the ESLZ template
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximeMahdavianSSC committed Dec 5, 2024
1 parent 8813dd6 commit 4b2f9db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions ESLZ/front-door.tf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
}
5 changes: 3 additions & 2 deletions module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
}
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 4b2f9db

Please sign in to comment.