Skip to content

Commit

Permalink
Merge pull request #3324 from DFE-Digital/2158-replace-terrafile
Browse files Browse the repository at this point in the history
[2158] Replace terrafile
  • Loading branch information
saliceti authored Dec 5, 2024
2 parents 4b242d3 + 0ba7317 commit 76b93d8
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 39 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ coverage
# Visual Studio Code
.vscode

# DevOps files

bin/terrafile

# Terraform files
vendor/

Expand Down
21 changes: 10 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
TERRAFILE_VERSION=0.8
ARM_TEMPLATE_TAG=1.1.6
RG_TAGS={"Product" : "Get School Experience"}
REGION=UK South
Expand Down Expand Up @@ -92,14 +91,12 @@ composed-variables:
$(eval KEYVAULT_NAMES='("${AZURE_RESOURCE_PREFIX}-${SERVICE_SHORT}-${CONFIG_SHORT}-app-kv", "${AZURE_RESOURCE_PREFIX}-${SERVICE_SHORT}-${CONFIG_SHORT}-inf-kv")')
$(eval STORAGE_ACCOUNT_NAME=${AZURE_RESOURCE_PREFIX}${SERVICE_SHORT}tfstate${CONFIG_SHORT}sa)

bin/terrafile: ## Install terrafile to manage terraform modules
curl -sL https://github.com/coretech/terrafile/releases/download/v${TERRAFILE_VERSION}/terrafile_${TERRAFILE_VERSION}_$$(uname)_$$(uname -m).tar.gz \
| tar xz -C ./bin terrafile

terraform-init: composed-variables bin/terrafile set-azure-account
terraform-init: composed-variables set-azure-account
$(if ${IMAGE_TAG}, , $(eval IMAGE_TAG=master))

./bin/terrafile -p terraform/aks/vendor/modules -f terraform/aks/config/$(CONFIG)_Terrafile
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

terraform -chdir=terraform/aks init -upgrade -reconfigure \
-backend-config=resource_group_name=${RESOURCE_GROUP_NAME} \
-backend-config=storage_account_name=${STORAGE_ACCOUNT_NAME} \
Expand Down Expand Up @@ -160,8 +157,9 @@ 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
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} \
Expand All @@ -174,8 +172,9 @@ 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/${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} \
Expand Down
1 change: 1 addition & 0 deletions global_config/development.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ AZURE_RESOURCE_PREFIX=s189t01
KV_PURGE_PROTECTION=false
PLATFORM=aks
IMAGE_TAG_PREFIX=sha
TERRAFORM_MODULES_TAG=testing
1 change: 1 addition & 0 deletions global_config/domains.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
AZURE_SUBSCRIPTION=s189-teacher-services-cloud-production
AZURE_RESOURCE_PREFIX=s189p01
TERRAFORM_MODULES_TAG=stable
1 change: 1 addition & 0 deletions global_config/production.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ AZURE_RESOURCE_PREFIX=s189p01
KV_PURGE_PROTECTION=false
PLATFORM=aks
IMAGE_TAG_PREFIX=sha
TERRAFORM_MODULES_TAG=stable
1 change: 1 addition & 0 deletions global_config/review.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ AZURE_RESOURCE_PREFIX=s189t01
KV_PURGE_PROTECTION=false
PLATFORM=aks
IMAGE_TAG_PREFIX=review
TERRAFORM_MODULES_TAG=main
1 change: 1 addition & 0 deletions global_config/staging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ AZURE_RESOURCE_PREFIX=s189t01
KV_PURGE_PROTECTION=false
PLATFORM=aks
IMAGE_TAG_PREFIX=sha
TERRAFORM_MODULES_TAG=testing
3 changes: 0 additions & 3 deletions terraform/aks/config/development_Terrafile

This file was deleted.

3 changes: 0 additions & 3 deletions terraform/aks/config/production_Terrafile

This file was deleted.

3 changes: 0 additions & 3 deletions terraform/aks/config/review_Terrafile

This file was deleted.

3 changes: 0 additions & 3 deletions terraform/aks/config/staging_Terrafile

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions terraform/domains/infrastructure/config/zones_Terrafile

This file was deleted.

0 comments on commit 76b93d8

Please sign in to comment.