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
# Configure the Azure provider | |
terraform { | |
required_providers { | |
azurerm = { | |
source = "hashicorp/azurerm" | |
version = "2.34.0" | |
} | |
} | |
} |
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
# Install Terraform extension to use this task from: | |
# https://marketplace.visualstudio.com/items?itemName=ms-devlabs.custom-terraform-tasks&ssr=false#overview | |
steps: | |
- task: ms-devlabs.custom-terraform-tasks.custom-terraform-installer-task.TerraformInstaller@0 | |
displayName: 'Install Terraform 0.14.0' | |
inputs: | |
terraformVersion: 0.14.0 | |
# Terraform versions: https://releases.hashicorp.com/terraform/ |
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 validate -json -no-color | |
workingDirectory: $(build.sourcesdirectory) | |
displayName: 'terraform validate' |
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 plan -var region=$(region) -var access_key=$(access_key) -var secret_key=$(secret_key) -out application.tfplan -no-color | |
workingDirectory: $(build.sourcesdirectory) | |
displayName: 'terraform plan' |
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 apply "application.tfplan" -no-color | |
workingDirectory: $(build.sourcesdirectory) | |
displayName: 'terraform apply' |
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 show -no-color | |
workingDirectory: $(build.sourcesdirectory) | |
displayName: 'terraform show' |
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
terraform { | |
backend "s3" { | |
bucket = "$(BackendBucketName)" # the name of the S3 bucket that was created | |
encrypt = true | |
key = "$(PathToTFStateFile)" # the path to the terraform.tfstate file stored inside the bucket | |
region = "$(BucketRegion)" # the location of the bucket | |
dynamodb_table = "$(BackendLockTableName)" # the name of the table to store the lock | |
} | |
} |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": [ | |
"dynamodb:PutItem", | |
"dynamodb:DeleteItem", | |
"dynamodb:GetItem" |
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
terraform { | |
backend "azurerm" { | |
resource_group_name = "$(ResourceGroupToStoreTerraformBackendResources)" | |
storage_account_name = "$(UniqueStorageAccountName)" | |
container_name = "$(StorageContainerName)" | |
key = "terraform.tfstate" | |
access_key = "$(StorageAccountAccessKey)" | |
} | |
} |
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="access_key=$(storage_access_key)" -no-color | |
workingDirectory: $(build.sourcesdirectory) | |
displayName: 'terraform init' | |
# where $(storage_access_key) is a secret variable stored in the Azure pipeline | |
# variable or a Library variable group. The value of the variable is the storage | |
# access key to the storage account where the terraform remote state file is stored |
OlderNewer