Created
December 16, 2019 17:59
-
-
Save jungopro/2ac9f850a9ea544953489212e6d2093e to your computer and use it in GitHub Desktop.
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
# Add steps that build, run tests, deploy, and more: | |
# https://aka.ms/yaml | |
name: Build-$(Build.BuildId) | |
trigger: none | |
pr: [dev] | |
pool: | |
vmImage: 'ubuntu-latest' | |
steps: | |
- task: TerraformInstaller@0 | |
displayName: 'Install Terraform version $(TF-Version)' | |
inputs: | |
terraformVersion: '$(TF-Version)' | |
- script: terraform init -get=true -upgrade=true -backend-config='storage_account_name=$(sa-name)' -backend-config='container_name=$(blob-name)' -backend-config='access_key=$(sa-key)' -backend-config='key=$(key)' | |
workingDirectory: '$(Build.SourcesDirectory)' | |
displayName: 'Terraform Init' | |
- script: terraform workspace select '$(Dev-WS)' || terraform workspace new '$(Dev-WS)' | |
workingDirectory: '$(Build.SourcesDirectory)' | |
displayName: 'Switch to Environment $(Dev-WS)' | |
- script: 'terraform validate' | |
workingDirectory: '$(Build.SourcesDirectory)' | |
displayName: 'Validate Terraform Code' | |
- script: 'terraform plan -lock=true -var="subscription_id=$(subscription-id)" -var="client_id=$(client-id)" -var="client_secret=$(client-secret)" -var="tenant_id=$(tenant-id)" -var="repo_name=$(repo-name)" -var="repo_username=$(repo-username)" -var="repo_password=$(repo-password)"' | |
workingDirectory: '$(Build.SourcesDirectory)' | |
displayName: 'Terraform Dry Run (Plan)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment