diff --git a/terraform/domains/environment_domains/config/production.tfvars.json b/terraform/domains/environment_domains/config/production.tfvars.json new file mode 100644 index 0000000000..ec177c73b2 --- /dev/null +++ b/terraform/domains/environment_domains/config/production.tfvars.json @@ -0,0 +1,16 @@ +{ + "hosted_zone": { + "claim-additional-teaching-payment.service.gov.uk": { + "front_door_name": "s189p01-capt-dom-fd", + "resource_group_name": "s189p01-capt-dom-rg", + "domains": [ + "apex" + ], + "cached_paths": [ + "/assets/*" + ], + "environment_short": "pd", + "origin_hostname": "s118p01-app-as.azurewebsites.net" + } + } +} diff --git a/terraform/domains/environment_domains/config/production_Terrafile b/terraform/domains/environment_domains/config/production_Terrafile new file mode 100644 index 0000000000..58e60b3c88 --- /dev/null +++ b/terraform/domains/environment_domains/config/production_Terrafile @@ -0,0 +1,3 @@ +domains: + source: "https://github.com/DFE-Digital/terraform-modules" + version: "stable" diff --git a/terraform/domains/environment_domains/config/test.tfvars.json b/terraform/domains/environment_domains/config/test.tfvars.json new file mode 100644 index 0000000000..80327c3c91 --- /dev/null +++ b/terraform/domains/environment_domains/config/test.tfvars.json @@ -0,0 +1,16 @@ +{ + "hosted_zone": { + "claim-additional-teaching-payment.service.gov.uk": { + "front_door_name": "s189p01-capt-dom-fd", + "resource_group_name": "s189p01-capt-dom-rg", + "domains": [ + "test" + ], + "cached_paths": [ + "/assets/*" + ], + "environment_short": "ts", + "origin_hostname": "s118t01-app-as.azurewebsites.net" + } + } +} diff --git a/terraform/domains/environment_domains/config/test_Terrafile b/terraform/domains/environment_domains/config/test_Terrafile new file mode 100644 index 0000000000..dfce270ef6 --- /dev/null +++ b/terraform/domains/environment_domains/config/test_Terrafile @@ -0,0 +1,3 @@ +domains: + source: "https://github.com/DFE-Digital/terraform-modules" + version: "testing" diff --git a/terraform/domains/environment_domains/main.tf b/terraform/domains/environment_domains/main.tf new file mode 100644 index 0000000000..50aacc8386 --- /dev/null +++ b/terraform/domains/environment_domains/main.tf @@ -0,0 +1,12 @@ +# Used to create domains to be managed by front door. +module "domains" { + for_each = var.hosted_zone + source = "./vendor/modules/domains//domains/environment_domains" + zone = each.key + front_door_name = each.value.front_door_name + resource_group_name = each.value.resource_group_name + domains = each.value.domains + environment = each.value.environment_short + host_name = each.value.origin_hostname + cached_paths = try(each.value.cached_paths, []) +} diff --git a/terraform/domains/environment_domains/terraform.tf b/terraform/domains/environment_domains/terraform.tf new file mode 100644 index 0000000000..a322044fe9 --- /dev/null +++ b/terraform/domains/environment_domains/terraform.tf @@ -0,0 +1,19 @@ +terraform { + + required_version = "= 1.8.4" + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "3.104.2" + } + } + backend "azurerm" { + container_name = "terraform-state" + } +} + +provider "azurerm" { + features {} + + skip_provider_registration = true +} diff --git a/terraform/domains/environment_domains/variables.tf b/terraform/domains/environment_domains/variables.tf new file mode 100644 index 0000000000..ad63e546fd --- /dev/null +++ b/terraform/domains/environment_domains/variables.tf @@ -0,0 +1,4 @@ +variable "hosted_zone" { + type = map(any) + default = {} +}