Skip to content

Commit

Permalink
Merge pull request #2940 from DFE-Digital/1750-claim-create-zone-in-s189
Browse files Browse the repository at this point in the history
[1750] DNS domains infrastructure
  • Loading branch information
saliceti authored Jul 1, 2024
2 parents 3fd9cbf + d7c78a7 commit fde40d9
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public/assets
# AKS deployment
.terraform
terraform/application/vendor
terraform/domains/infrastructure/vendor
terraform/domains/environment_domains/vendor
terraform.tfstate*
bin/terrafile
Expand Down
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,31 @@ get-cluster-credentials: set-azure-account-aks
bin/konduit.sh:
curl -s https://raw.githubusercontent.com/DFE-Digital/teacher-services-cloud/main/scripts/konduit.sh -o bin/konduit.sh \
&& chmod +x bin/konduit.sh

domains-infra-init: bin/terrafile domains composed-variables set-azure-account-aks
./bin/terrafile -p terraform/domains/infrastructure/vendor/modules -f terraform/domains/infrastructure/config/zones_Terrafile

terraform -chdir=terraform/domains/infrastructure init -reconfigure -upgrade \
-backend-config=resource_group_name=${RESOURCE_GROUP_NAME} \
-backend-config=storage_account_name=${STORAGE_ACCOUNT_NAME} \
-backend-config=key=domains_infrastructure.tfstate

domains-infra-plan: domains domains-infra-init ## Terraform plan for DNS infrastructure (DNS zone and front door). Usage: make domains-infra-plan
terraform -chdir=terraform/domains/infrastructure plan -var-file config/zones.tfvars.json

domains-infra-apply: domains domains-infra-init ## Terraform apply for DNS infrastructure (DNS zone and front door). Usage: make domains-infra-apply
terraform -chdir=terraform/domains/infrastructure apply -var-file config/zones.tfvars.json ${AUTO_APPROVE}

domains-init: bin/terrafile domains composed-variables set-azure-account-aks
./bin/terrafile -p terraform/domains/environment_domains/vendor/modules -f terraform/domains/environment_domains/config/${CONFIG}_Terrafile

terraform -chdir=terraform/domains/environment_domains init -upgrade -reconfigure \
-backend-config=resource_group_name=${RESOURCE_GROUP_NAME} \
-backend-config=storage_account_name=${STORAGE_ACCOUNT_NAME} \
-backend-config=key=${ENVIRONMENT}.tfstate

domains-plan: domains-init ## Terraform plan for DNS environment domains. Usage: make development domains-plan
terraform -chdir=terraform/domains/environment_domains plan -var-file config/${CONFIG}.tfvars.json

domains-apply: domains-init ## Terraform apply for DNS environment domains. Usage: make development domains-apply
terraform -chdir=terraform/domains/environment_domains apply -var-file config/${CONFIG}.tfvars.json ${AUTO_APPROVE}
4 changes: 4 additions & 0 deletions global_config/domains.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
AZURE_SUBSCRIPTION=s189-teacher-services-cloud-production
AZURE_RESOURCE_PREFIX=s189p01
CONFIG_SHORT=dom
DISABLE_KEYVAULTS=true
11 changes: 11 additions & 0 deletions terraform/domains/infrastructure/config/zones.tfvars.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"hosted_zone": {
"claim-additional-teaching-payment.service.gov.uk": {
"caa_records": {},
"txt_records": {},
"resource_group_name": "s189p01-capt-dom-rg",
"front_door_name": "s189p01-capt-dom-fd"
}
},
"deploy_default_records": false
}
3 changes: 3 additions & 0 deletions terraform/domains/infrastructure/config/zones_Terrafile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
domains:
source: "https://github.com/DFE-Digital/terraform-modules"
version: "stable"
5 changes: 5 additions & 0 deletions terraform/domains/infrastructure/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module "domains_infrastructure" {
source = "./vendor/modules/domains//domains/infrastructure"
hosted_zone = var.hosted_zone
deploy_default_records = var.deploy_default_records
}
19 changes: 19 additions & 0 deletions terraform/domains/infrastructure/terraform.tf
Original file line number Diff line number Diff line change
@@ -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
}
7 changes: 7 additions & 0 deletions terraform/domains/infrastructure/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
variable "hosted_zone" {
type = map(any)
}

variable "deploy_default_records" {
default = true
}

0 comments on commit fde40d9

Please sign in to comment.