Skip to content

Commit

Permalink
Merge pull request #204 from DFE-Digital/2146-spike-replace-terrafile
Browse files Browse the repository at this point in the history
[2146] Replace terrafile
  • Loading branch information
saliceti authored Nov 28, 2024
2 parents 6456e84 + a35f644 commit 36a6d56
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 52 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
.vscode/

# Ignore terraform files
bin/terrafile
.terraform
terraform/application/vendor
terraform/domains/environment_domains/vendor
Expand Down
18 changes: 9 additions & 9 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.10
RG_TAGS={"Product" : "Teacher services cloud"}
REGION=UK South
Expand Down Expand Up @@ -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} \
Expand Down Expand Up @@ -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} \
Expand All @@ -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} \
Expand Down
1 change: 1 addition & 0 deletions global_config/domains.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions global_config/production.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions global_config/review.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 0 additions & 3 deletions terraform/application/config/production_Terrafile

This file was deleted.

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

This file was deleted.

28 changes: 14 additions & 14 deletions terraform/domains/environment_domains/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

2 changes: 1 addition & 1 deletion terraform/domains/environment_domains/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.82.0"
version = "3.116.0"
}
}
backend "azurerm" {
Expand Down
28 changes: 14 additions & 14 deletions terraform/domains/infrastructure/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

This file was deleted.

2 changes: 1 addition & 1 deletion terraform/domains/infrastructure/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.82.0"
version = "3.116.0"
}
}
backend "azurerm" {
Expand Down

0 comments on commit 36a6d56

Please sign in to comment.