Last active
February 12, 2024 14:51
-
-
Save dustindortch/b9feec78f89ea85a5fd6d9d9741d60f1 to your computer and use it in GitHub Desktop.
Terraform Best Practices: Files - Generating backend configuration in a pipeline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Terraform Set Backend | |
id: tf-set-backend | |
run: | | |
cat > ./backend.tf << EOF | |
terraform { | |
backend "azurerm" { | |
container_name = "${{vars.TFSTATE_CONTAINER_NAME}}" | |
key = "${{vars.TFSTATE_KEY}}" | |
resource_group_name = "${{vars.TFSTATE_RESOURCE_GROUP_NAME}}" | |
storage_account_name = "${{vars.TFSTATE_STORAGE_ACCOUNT_NAME}}" | |
subscription_id = "${{vars.SA_SUBSCRIPTION_ID}}" | |
use_oidc = true | |
} | |
} | |
EOF | |
- name: Terraform Init | |
id: tf-init | |
run: terraform init |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment