We’ve improved and updated our original terraform-azure-boostrap script! The script is now offered directly from a Westridge Group Github public repository. We have made a few minor changes unfortunately they maybe breaking changes depending on how you have used it in the past, so we have created a 2.0.0 release. The main difference is the script now requires the user to “source” the file and then call the functions. The older version, v1.1.0, had you source the file at the same time provide the .tfvars file and it automatically ran the terraform_setup. Then it was up to you to use terraform apply appropriately we just feel the new setup is more hands off and user friendly.
v2.0.0 Release Notes
- TerraformAzureBootstrap now provides functions which need to be called, the file should still be sourced.
- New Functions:
- terraform_setup
- Reads Subscription Id from the key vault and assigns it to the Terraform AzureRM environment variable ARM_SUBSCRIPTION_ID
- Reads Client Id from the key vault and assigns it to the Terraform AzureRM environment variable ARM_CLIENT_ID
- Reads Client secret from the key vault and assigns it to the Terraform AzureRM environment variable ARM_CLIENT_SECRET
- Reads Tenant Id from the key vault and assigns it to the Terraform AzureRM environment variable ARM_TENANT_ID
- Reads Storage Account Key th from key vault and assigns it to the Terraform AzureRM environment variable ARM_ACCESS_KEY
- Takes the .tfvars name as input, reads the State Container and State Key in to memory from the file and stores the file location
- Lastly runs terraform init with all of the relevant above information to use Azure as the backend for Terraform
- terraform_plan
- Executes terraform plan setting the -var-file value to the .tfvars file read in from the terraform setup outputting the information to terraform.plan
- terraform_apply
- Executes terraform apply using the terraform.plan outputted from the terraform_plan command
- terraform_destroy
- Executes terraform apply -destroy command
- terraform_setup
- Tested for Terraform 1.7.3 on darwin_arm64 & az-cli 2.57.0 on darwin
Links