diff --git a/.gitignore b/.gitignore index 69eafff427..19895f13c8 100644 --- a/.gitignore +++ b/.gitignore @@ -42,7 +42,6 @@ yarn-debug.log* .vscode/ # DevOps files -bin/terrafile bin/konduit.sh # Terraform files diff --git a/Makefile b/Makefile index 36540bef38..bbf74c1979 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ -TERRAFILE_VERSION=0.8 ARM_TEMPLATE_TAG=1.1.8 RG_TAGS={"Product" : "Get into teaching website"} REGION=UK South @@ -91,19 +90,19 @@ composed-variables: $(eval STORAGE_ACCOUNT_NAME=${AZURE_RESOURCE_PREFIX}${SERVICE_SHORT}${CONFIG_SHORT}tfsa) $(eval LOG_ANALYTICS_WORKSPACE_NAME=${AZURE_RESOURCE_PREFIX}-${SERVICE_SHORT}-${CONFIG_SHORT}-log) -bin/terrafile: ## Install terrafile to manage terraform modules - curl -sL https://github.com/coretech/terrafile/releases/download/v${TERRAFILE_VERSION}/terrafile_${TERRAFILE_VERSION}_$$(uname)_x86_64.tar.gz \ - | tar xz -C ./bin terrafile +.PHONY: vendor-modules +vendor-modules: + rm -rf terraform/aks/vendor/modules/aks + git -c advice.detachedHead=false clone --depth=1 --single-branch --branch ${TERRAFORM_MODULES_TAG} https://github.com/DFE-Digital/terraform-modules.git terraform/aks/vendor/modules/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 -terraform-init: composed-variables bin/terrafile set-azure-account +terraform-init: composed-variables vendor-modules set-azure-account $(if ${DOCKER_IMAGE_TAG}, , $(eval DOCKER_IMAGE_TAG=master)) $(if $(PR_NUMBER), $(eval KEY_PREFIX=$(PR_NUMBER)), $(eval KEY_PREFIX=$(ENVIRONMENT))) - ./bin/terrafile -p terraform/aks/vendor/modules -f terraform/aks/config/$(CONFIG)_Terrafile terraform -chdir=terraform/aks init -upgrade -reconfigure \ -backend-config=resource_group_name=${RESOURCE_GROUP_NAME} \ -backend-config=storage_account_name=${STORAGE_ACCOUNT_NAME} \ @@ -159,9 +158,13 @@ deploy-domain-arm-resources: domains domains-composed-variables arm-deployment # validate-domain-arm-resources: set-what-if domains domains-composed-variables arm-deployment ## Validate what Azure resources will be deployed. Usage: make validate-domain-arm-resources -domains-infra-init: bin/terrafile domains-composed-variables set-azure-account - ./bin/terrafile -p terraform/domains/infrastructure/vendor/modules -f terraform/domains/infrastructure/config/zones_Terrafile +.PHONY: vendor-domain-infra-modules +vendor-domain-infra-modules: + rm -rf terraform/domains/infrastructure/vendor/modules/domains + TERRAFORM_MODULES_TAG=stable + git -c advice.detachedHead=false clone --depth=1 --single-branch --branch ${TERRAFORM_MODULES_TAG} https://github.com/DFE-Digital/terraform-modules.git terraform/domains/infrastructure/vendor/modules/domains +domains-infra-init: domains-composed-variables vendor-domain-infra-modules set-azure-account terraform -chdir=terraform/domains/infrastructure init -reconfigure -upgrade \ -backend-config=resource_group_name=${RESOURCE_GROUP_NAME} \ -backend-config=storage_account_name=${STORAGE_ACCOUNT_NAME} \ @@ -173,9 +176,12 @@ domains-infra-plan: domains domains-infra-init ## Terraform plan for DNS infrast domains-infra-apply: domains domains-infra-init ## Terraform apply for DNS infrastructure (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 - ./bin/terrafile -p terraform/domains/environment_domains/vendor/modules -f terraform/domains/environment_domains/config/${ENVIRONMENT}_Terrafile +.PHONY: vendor-domain-modules +vendor-domain-modules: + rm -rf terraform/domains/environment_domains/vendor/modules/domains + git -c advice.detachedHead=false clone --depth=1 --single-branch --branch ${TERRAFORM_MODULES_TAG} https://github.com/DFE-Digital/terraform-modules.git terraform/domains/environment_domains/vendor/modules/domains +domains-init: domains-composed-variables vendor-domain-modules set-azure-account 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} \ diff --git a/global_config/beta.sh b/global_config/beta.sh index 057c9a0f78..b32dff0cf9 100644 --- a/global_config/beta.sh +++ b/global_config/beta.sh @@ -4,3 +4,4 @@ CONFIG_SHORT=bt AZURE_SUBSCRIPTION=s189-teacher-services-cloud-production AZURE_RESOURCE_PREFIX=s189p01 ENABLE_KV_DIAGNOSTICS=true +TERRAFORM_MODULES_TAG=main diff --git a/global_config/development.sh b/global_config/development.sh index e9ab4b6c67..a521cd84fc 100644 --- a/global_config/development.sh +++ b/global_config/development.sh @@ -4,3 +4,4 @@ CONFIG_SHORT=dv AZURE_SUBSCRIPTION=s189-teacher-services-cloud-test AZURE_RESOURCE_PREFIX=s189t01 KV_PURGE_PROTECTION=false +TERRAFORM_MODULES_TAG=main diff --git a/global_config/domains.sh b/global_config/domains.sh index 720137ab4d..1082d936ae 100644 --- a/global_config/domains.sh +++ b/global_config/domains.sh @@ -1,2 +1,3 @@ AZURE_SUBSCRIPTION=s189-teacher-services-cloud-production AZURE_RESOURCE_PREFIX=s189p01 +TERRAFORM_MODULES_TAG=stable diff --git a/global_config/production.sh b/global_config/production.sh index 0a122077b3..c52ab317f2 100644 --- a/global_config/production.sh +++ b/global_config/production.sh @@ -4,3 +4,4 @@ CONFIG_SHORT=pd AZURE_SUBSCRIPTION=s189-teacher-services-cloud-production AZURE_RESOURCE_PREFIX=s189p01 ENABLE_KV_DIAGNOSTICS=true +TERRAFORM_MODULES_TAG=stable diff --git a/global_config/review.sh b/global_config/review.sh index 564bdd2caf..b3c015b011 100644 --- a/global_config/review.sh +++ b/global_config/review.sh @@ -4,3 +4,4 @@ CONFIG_SHORT=rv AZURE_SUBSCRIPTION=s189-teacher-services-cloud-test AZURE_RESOURCE_PREFIX=s189t01 KV_PURGE_PROTECTION=false +TERRAFORM_MODULES_TAG=main diff --git a/global_config/test.sh b/global_config/test.sh index ad8eae4807..f87b5b22ee 100644 --- a/global_config/test.sh +++ b/global_config/test.sh @@ -4,3 +4,4 @@ CONFIG_SHORT=ts AZURE_SUBSCRIPTION=s189-teacher-services-cloud-test AZURE_RESOURCE_PREFIX=s189t01 KV_PURGE_PROTECTION=false +TERRAFORM_MODULES_TAG=testing diff --git a/terraform/aks/config/development_Terrafile b/terraform/aks/config/development_Terrafile deleted file mode 100644 index 65af53b11d..0000000000 --- a/terraform/aks/config/development_Terrafile +++ /dev/null @@ -1,3 +0,0 @@ -aks: - source: "https://github.com/DFE-Digital/terraform-modules" - version: "main" diff --git a/terraform/aks/config/production_Terrafile b/terraform/aks/config/production_Terrafile deleted file mode 100644 index 5b2b118f00..0000000000 --- a/terraform/aks/config/production_Terrafile +++ /dev/null @@ -1,3 +0,0 @@ -aks: - source: "https://github.com/DFE-Digital/terraform-modules" - version: "stable" diff --git a/terraform/aks/config/review_Terrafile b/terraform/aks/config/review_Terrafile deleted file mode 100644 index 65af53b11d..0000000000 --- a/terraform/aks/config/review_Terrafile +++ /dev/null @@ -1,3 +0,0 @@ -aks: - source: "https://github.com/DFE-Digital/terraform-modules" - version: "main" diff --git a/terraform/aks/config/test_Terrafile b/terraform/aks/config/test_Terrafile deleted file mode 100644 index b4c222c13d..0000000000 --- a/terraform/aks/config/test_Terrafile +++ /dev/null @@ -1,3 +0,0 @@ -aks: - source: "https://github.com/DFE-Digital/terraform-modules" - version: "testing" diff --git a/terraform/domains/environment_domains/config/beta_Terrafile b/terraform/domains/environment_domains/config/beta_Terrafile deleted file mode 100644 index 19a4aecd6b..0000000000 --- a/terraform/domains/environment_domains/config/beta_Terrafile +++ /dev/null @@ -1,3 +0,0 @@ -domains: - source: "https://github.com/DFE-Digital/terraform-modules" - version: "main" diff --git a/terraform/domains/environment_domains/config/production_Terrafile b/terraform/domains/environment_domains/config/production_Terrafile deleted file mode 100644 index 58e60b3c88..0000000000 --- a/terraform/domains/environment_domains/config/production_Terrafile +++ /dev/null @@ -1,3 +0,0 @@ -domains: - source: "https://github.com/DFE-Digital/terraform-modules" - version: "stable" diff --git a/terraform/domains/environment_domains/config/test_Terrafile b/terraform/domains/environment_domains/config/test_Terrafile deleted file mode 100644 index dfce270ef6..0000000000 --- a/terraform/domains/environment_domains/config/test_Terrafile +++ /dev/null @@ -1,3 +0,0 @@ -domains: - source: "https://github.com/DFE-Digital/terraform-modules" - version: "testing" diff --git a/terraform/domains/infrastructure/config/zones_Terrafile b/terraform/domains/infrastructure/config/zones_Terrafile deleted file mode 100644 index 58e60b3c88..0000000000 --- a/terraform/domains/infrastructure/config/zones_Terrafile +++ /dev/null @@ -1,3 +0,0 @@ -domains: - source: "https://github.com/DFE-Digital/terraform-modules" - version: "stable"