From d95a806e0351585616b70b0461cfd2ba643debd7 Mon Sep 17 00:00:00 2001 From: Colin Saliceti Date: Thu, 5 Dec 2024 16:17:04 +0000 Subject: [PATCH] Replace terrafile terrafile is no longer maintained. Replace with simple git command --- .gitignore | 1 - Makefile | 21 +++++++++---------- global_config/domains.sh | 1 + global_config/production.sh | 1 + global_config/review.sh | 1 + global_config/test.sh | 1 + .../application/config/production_Terrafile | 3 --- terraform/application/config/review_Terrafile | 3 --- terraform/application/config/test_Terrafile | 3 --- .../config/production_Terrafile | 3 --- .../environment_domains/config/test_Terrafile | 3 --- .../infrastructure/config/zones_Terrafile | 3 --- 12 files changed, 14 insertions(+), 30 deletions(-) delete mode 100644 terraform/application/config/production_Terrafile delete mode 100644 terraform/application/config/review_Terrafile delete mode 100644 terraform/application/config/test_Terrafile delete mode 100644 terraform/domains/environment_domains/config/production_Terrafile delete mode 100644 terraform/domains/environment_domains/config/test_Terrafile delete mode 100644 terraform/domains/infrastructure/config/zones_Terrafile diff --git a/.gitignore b/.gitignore index 2609eac100..daf755f499 100644 --- a/.gitignore +++ b/.gitignore @@ -62,5 +62,4 @@ terraform/application/vendor terraform/domains/infrastructure/vendor terraform/domains/environment_domains/vendor terraform.tfstate* -bin/terrafile bin/konduit.sh diff --git a/Makefile b/Makefile index 938d77d096..37ffc3987a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ -TERRAFILE_VERSION=0.8 ARM_TEMPLATE_TAG=1.1.10 RG_TAGS={"Product" : "Claim Additional Payments for teaching"} REGION=UK South @@ -28,10 +27,12 @@ production: production-cluster set-azure-account: [ "${SKIP_AZURE_LOGIN}" != "true" ] && az account set -s ${AZURE_SUBSCRIPTION} || true -terraform-init: composed-variables bin/terrafile set-azure-account +terraform-init: composed-variables set-azure-account $(if ${DOCKER_IMAGE_TAG}, , $(eval DOCKER_IMAGE_TAG=master)) - ./bin/terrafile -p terraform/application/vendor/modules -f terraform/application/config/$(CONFIG)_Terrafile + rm -rf terraform/application/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/application/vendor/modules/aks + terraform -chdir=terraform/application init -upgrade -reconfigure \ -backend-config=resource_group_name=${RESOURCE_GROUP_NAME} \ -backend-config=storage_account_name=${STORAGE_ACCOUNT_NAME} \ @@ -66,10 +67,6 @@ ci: $(eval SKIP_AZURE_LOGIN=true) $(eval SKIP_CONFIRM=true) -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 - set-what-if: $(eval WHAT_IF=--what-if) @@ -106,8 +103,9 @@ 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 - ./bin/terrafile -p terraform/domains/infrastructure/vendor/modules -f terraform/domains/infrastructure/config/zones_Terrafile +domains-infra-init: domains composed-variables set-azure-account + rm -rf terraform/domains/infrastructure/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/infrastructure/vendor/modules/domains terraform -chdir=terraform/domains/infrastructure init -reconfigure -upgrade \ -backend-config=resource_group_name=${RESOURCE_GROUP_NAME} \ @@ -120,8 +118,9 @@ domains-infra-plan: domains domains-infra-init ## Terraform plan for DNS infras 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 - ./bin/terrafile -p terraform/domains/environment_domains/vendor/modules -f terraform/domains/environment_domains/config/${CONFIG}_Terrafile +domains-init: domains composed-variables set-azure-account + 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 terraform -chdir=terraform/domains/environment_domains init -upgrade -reconfigure \ -backend-config=resource_group_name=${RESOURCE_GROUP_NAME} \ diff --git a/global_config/domains.sh b/global_config/domains.sh index a7b7641875..7faeff71db 100644 --- a/global_config/domains.sh +++ b/global_config/domains.sh @@ -2,3 +2,4 @@ AZURE_SUBSCRIPTION=s189-teacher-services-cloud-production AZURE_RESOURCE_PREFIX=s189p01 CONFIG_SHORT=dom DISABLE_KEYVAULTS=true +TERRAFORM_MODULES_TAG=stable diff --git a/global_config/production.sh b/global_config/production.sh index ae36b87ca0..82da93efe1 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 KV_PURGE_PROTECTION=true +TERRAFORM_MODULES_TAG=stable diff --git a/global_config/review.sh b/global_config/review.sh index 6f2c5d5c2e..832b23bb76 100644 --- a/global_config/review.sh +++ b/global_config/review.sh @@ -3,3 +3,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/application/config/production_Terrafile b/terraform/application/config/production_Terrafile deleted file mode 100644 index 5b2b118f00..0000000000 --- a/terraform/application/config/production_Terrafile +++ /dev/null @@ -1,3 +0,0 @@ -aks: - source: "https://github.com/DFE-Digital/terraform-modules" - version: "stable" diff --git a/terraform/application/config/review_Terrafile b/terraform/application/config/review_Terrafile deleted file mode 100644 index 65af53b11d..0000000000 --- a/terraform/application/config/review_Terrafile +++ /dev/null @@ -1,3 +0,0 @@ -aks: - source: "https://github.com/DFE-Digital/terraform-modules" - version: "main" diff --git a/terraform/application/config/test_Terrafile b/terraform/application/config/test_Terrafile deleted file mode 100644 index b4c222c13d..0000000000 --- a/terraform/application/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/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"