From b11fcfa90082a8f36f2468fc06589c67115f1ad2 Mon Sep 17 00:00:00 2001 From: Colin Saliceti Date: Fri, 22 Nov 2024 15:17:03 +0000 Subject: [PATCH 1/2] Replace terrafile terrafile is not maintained anymore. Replacing with simple git command --- .gitignore | 1 - Makefile | 18 +++++++++--------- global_config/domains.sh | 1 + global_config/production.sh | 1 + global_config/review.sh | 1 + .../application/config/production_Terrafile | 3 --- terraform/application/config/review_Terrafile | 3 --- .../config/production_Terrafile | 3 --- .../infrastructure/config/zones_Terrafile | 3 --- 9 files changed, 12 insertions(+), 22 deletions(-) delete mode 100644 terraform/application/config/production_Terrafile delete mode 100644 terraform/application/config/review_Terrafile delete mode 100644 terraform/domains/environment_domains/config/production_Terrafile delete mode 100644 terraform/domains/infrastructure/config/zones_Terrafile diff --git a/.gitignore b/.gitignore index dc61568e..70333c49 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,6 @@ .vscode/ # Ignore terraform files -bin/terrafile .terraform terraform/application/vendor terraform/domains/environment_domains/vendor diff --git a/Makefile b/Makefile index 1aca3c5c..41a3ae0a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ -TERRAFILE_VERSION=0.8 ARM_TEMPLATE_TAG=1.1.10 RG_TAGS={"Product" : "Teacher services cloud"} REGION=UK South @@ -32,17 +31,15 @@ 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-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=main)) - ./bin/terrafile -p terraform/application/vendor/modules -f terraform/application/config/$(CONFIG)_Terrafile + rm -rf terraform/application/vendor/modules/aks + git 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} \ @@ -107,8 +104,10 @@ build: check-links: build bundle exec ruby -rhtml-proofer -e "HTMLProofer.check_directory('./build',{:hydra => { :max_concurrency => 1 }}).run" + domains-infra-init: domains composed-variables set-azure-account - ./bin/terrafile -p terraform/domains/infrastructure/vendor/modules -f terraform/domains/infrastructure/config/zones_Terrafile + rm -rf terraform/domains/infrastructure/vendor/modules/domains + git 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} \ @@ -122,7 +121,8 @@ domains-infra-apply: domains composed-variables domains-infra-init terraform -chdir=terraform/domains/infrastructure apply -var-file config/zones.tfvars.json ${AUTO_APPROVE} domains-init: domains composed-variables set-azure-account - ./bin/terrafile -p terraform/domains/environment_domains/vendor/modules -f terraform/domains/environment_domains/config/${CONFIG}_Terrafile + rm -rf terraform/domains/environment_domains/vendor/modules/domains + git 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 a7b76418..7faeff71 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 0a122077..c52ab317 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 6f2c5d5c..832b23bb 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/terraform/application/config/production_Terrafile b/terraform/application/config/production_Terrafile deleted file mode 100644 index 65af53b1..00000000 --- a/terraform/application/config/production_Terrafile +++ /dev/null @@ -1,3 +0,0 @@ -aks: - source: "https://github.com/DFE-Digital/terraform-modules" - version: "main" diff --git a/terraform/application/config/review_Terrafile b/terraform/application/config/review_Terrafile deleted file mode 100644 index 65af53b1..00000000 --- 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/domains/environment_domains/config/production_Terrafile b/terraform/domains/environment_domains/config/production_Terrafile deleted file mode 100644 index 58e60b3c..00000000 --- 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/infrastructure/config/zones_Terrafile b/terraform/domains/infrastructure/config/zones_Terrafile deleted file mode 100644 index 58e60b3c..00000000 --- a/terraform/domains/infrastructure/config/zones_Terrafile +++ /dev/null @@ -1,3 +0,0 @@ -domains: - source: "https://github.com/DFE-Digital/terraform-modules" - version: "stable" From a35f6445d6914cb07eb3fd3f48a03f8b9492d520 Mon Sep 17 00:00:00 2001 From: Colin Saliceti Date: Thu, 28 Nov 2024 14:52:57 +0000 Subject: [PATCH 2/2] Upgrade azurerm provider to 3.116.0 The previous version was causing error: Error: "conditions.0.url_path_condition.0.match_values.0" must not begin with the URLs leading slash(e.g. /), got "/.well-known/security.txt" --- .../environment_domains/.terraform.lock.hcl | 28 +++++++++---------- .../domains/environment_domains/terraform.tf | 2 +- .../infrastructure/.terraform.lock.hcl | 28 +++++++++---------- terraform/domains/infrastructure/terraform.tf | 2 +- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/terraform/domains/environment_domains/.terraform.lock.hcl b/terraform/domains/environment_domains/.terraform.lock.hcl index ffe3b5eb..2ea2d9c7 100644 --- a/terraform/domains/environment_domains/.terraform.lock.hcl +++ b/terraform/domains/environment_domains/.terraform.lock.hcl @@ -2,21 +2,21 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/azurerm" { - version = "3.82.0" - constraints = "3.82.0" + version = "3.116.0" + constraints = "3.116.0" hashes = [ - "h1:wIfGA8icS9CbbMfHQFRAUddF2/emdmvJbkTZxfEJTXg=", - "zh:2042c5485476b0b9dbcebfc01d95e1cec50b37b2c443ffd9824a4fc6a7b293bd", - "zh:3fc6753c039bac1866b90f5faf5f72edc7470cb64c1e84f830e71931dfced865", - "zh:4760c4595a5e8a07c5eef08304877909f88252c1536432e443211ae668456459", - "zh:4886aadcafcd88d036c3e36019ca3b0b39a6b7cfbd34f88fe8a544ca337af14f", - "zh:631602a5e38cb3ee8f8a2a2257e669f41ff05766a774eb19933d54ae1832c100", - "zh:6c03c113c729614598cb197415a3dd7b7d0fcb0aec9055b0491f02274e244582", - "zh:95390bd4037f695329a38ff1a736e4f03c134097d19201f89c5e6c08a11becb9", - "zh:ac1a1dd5559c53f72f89320f0cd9aeb8fc84ad1351b6578f99efc07c16486a2a", - "zh:b96d4ca8a05a1903accd5c1b16109444d05868198a4698e31c17ef7ab95c4541", - "zh:ccc5895c0579e4f5b0dc2d358579d417c21281104591f1877525d87f31079f96", - "zh:e0c496ab8f07ea381bbed86eefde47480b9b156bb022b2215c94cb01779c7076", + "h1:2QbjtN4oMXzdA++Nvrj/wSmWZTPgXKOSFGGQCLEMrb4=", + "zh:02b6606aff025fc2a962b3e568e000300abe959adac987183c24dac8eb057f4d", + "zh:2a23a8ce24ff9e885925ffee0c3ea7eadba7a702541d05869275778aa47bdea7", + "zh:57d10746384baeca4d5c56e88872727cdc150f437b8c5e14f0542127f7475e24", + "zh:59e3ebde1a2e1e094c671e179f231ead60684390dbf02d2b1b7fe67a228daa1a", + "zh:5f1f5c7d09efa2ee8ddf21bd9efbbf8286f6e90047556bef305c062fa0ac5880", + "zh:a40646aee3c9907276dab926e6123a8d70b1e56174836d4c59a9992034f88d70", + "zh:c21d40461bc5836cf56ad3d93d2fc47f61138574a55e972ad5ff1cb73bab66dc", + "zh:c56fb91a5ae66153ba0f737a26da1b3d4f88fdef7d41c63e06c5772d93b26953", + "zh:d1e60e85f51d12fc150aeab8e31d3f18f859c32f927f99deb5b74cb1e10087aa", + "zh:ed35e727e7d79e687cd3d148f52b442961ede286e7c5b4da1dcd9f0128009466", "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", + "zh:f6d2a4e7c58f44e7d04a4a9c73f35ed452f412c97c85def68c4b52814cbe03ab", ] } diff --git a/terraform/domains/environment_domains/terraform.tf b/terraform/domains/environment_domains/terraform.tf index 0fb33395..5a9b7aa6 100644 --- a/terraform/domains/environment_domains/terraform.tf +++ b/terraform/domains/environment_domains/terraform.tf @@ -4,7 +4,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.82.0" + version = "3.116.0" } } backend "azurerm" { diff --git a/terraform/domains/infrastructure/.terraform.lock.hcl b/terraform/domains/infrastructure/.terraform.lock.hcl index ffe3b5eb..2ea2d9c7 100644 --- a/terraform/domains/infrastructure/.terraform.lock.hcl +++ b/terraform/domains/infrastructure/.terraform.lock.hcl @@ -2,21 +2,21 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/azurerm" { - version = "3.82.0" - constraints = "3.82.0" + version = "3.116.0" + constraints = "3.116.0" hashes = [ - "h1:wIfGA8icS9CbbMfHQFRAUddF2/emdmvJbkTZxfEJTXg=", - "zh:2042c5485476b0b9dbcebfc01d95e1cec50b37b2c443ffd9824a4fc6a7b293bd", - "zh:3fc6753c039bac1866b90f5faf5f72edc7470cb64c1e84f830e71931dfced865", - "zh:4760c4595a5e8a07c5eef08304877909f88252c1536432e443211ae668456459", - "zh:4886aadcafcd88d036c3e36019ca3b0b39a6b7cfbd34f88fe8a544ca337af14f", - "zh:631602a5e38cb3ee8f8a2a2257e669f41ff05766a774eb19933d54ae1832c100", - "zh:6c03c113c729614598cb197415a3dd7b7d0fcb0aec9055b0491f02274e244582", - "zh:95390bd4037f695329a38ff1a736e4f03c134097d19201f89c5e6c08a11becb9", - "zh:ac1a1dd5559c53f72f89320f0cd9aeb8fc84ad1351b6578f99efc07c16486a2a", - "zh:b96d4ca8a05a1903accd5c1b16109444d05868198a4698e31c17ef7ab95c4541", - "zh:ccc5895c0579e4f5b0dc2d358579d417c21281104591f1877525d87f31079f96", - "zh:e0c496ab8f07ea381bbed86eefde47480b9b156bb022b2215c94cb01779c7076", + "h1:2QbjtN4oMXzdA++Nvrj/wSmWZTPgXKOSFGGQCLEMrb4=", + "zh:02b6606aff025fc2a962b3e568e000300abe959adac987183c24dac8eb057f4d", + "zh:2a23a8ce24ff9e885925ffee0c3ea7eadba7a702541d05869275778aa47bdea7", + "zh:57d10746384baeca4d5c56e88872727cdc150f437b8c5e14f0542127f7475e24", + "zh:59e3ebde1a2e1e094c671e179f231ead60684390dbf02d2b1b7fe67a228daa1a", + "zh:5f1f5c7d09efa2ee8ddf21bd9efbbf8286f6e90047556bef305c062fa0ac5880", + "zh:a40646aee3c9907276dab926e6123a8d70b1e56174836d4c59a9992034f88d70", + "zh:c21d40461bc5836cf56ad3d93d2fc47f61138574a55e972ad5ff1cb73bab66dc", + "zh:c56fb91a5ae66153ba0f737a26da1b3d4f88fdef7d41c63e06c5772d93b26953", + "zh:d1e60e85f51d12fc150aeab8e31d3f18f859c32f927f99deb5b74cb1e10087aa", + "zh:ed35e727e7d79e687cd3d148f52b442961ede286e7c5b4da1dcd9f0128009466", "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", + "zh:f6d2a4e7c58f44e7d04a4a9c73f35ed452f412c97c85def68c4b52814cbe03ab", ] } diff --git a/terraform/domains/infrastructure/terraform.tf b/terraform/domains/infrastructure/terraform.tf index 65b9162e..1161707f 100644 --- a/terraform/domains/infrastructure/terraform.tf +++ b/terraform/domains/infrastructure/terraform.tf @@ -4,7 +4,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.82.0" + version = "3.116.0" } } backend "azurerm" {