-
-
Save kunduso/4816eeecabb7c81553dec939b204119f to your computer and use it in GitHub Desktop.
Using powershell in azure-pipelins.yaml for terraform init
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
- powershell: | | |
terraform init -backend-config="bucket=skundu-terraform-remote-state" -backend-config="key=tf/ADO-TF-VPC-Int/terraform.tfstate" -backend-config="region=$(region)" -backend-config="access_key=$(access_key)" -backend-config="secret_key=$(secret_key)" -no-color | |
workingDirectory: $(build.sourcesdirectory) | |
displayName: 'terraform init' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The above is an example of a "terraform init" command where the remote state is stored in a bucket named "skundu-terraform-remote-state" and inside the bucket the terraform.tfstate file is nested two folders (tf/ADO-TF-VPC-Int/) deep relative to the bucket.$(region) value is the region of the bucket and $ (access_key) is the access key and $(secret_key) is the secret key respectively of the IAM user that Terraform is going to run as.
The