Last active
June 6, 2020 20:53
-
-
Save rudolphjacksonm/932789e6054e0274fd43a11ff68924c0 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
--- | |
parameters: | |
- name: serviceConnectionName | |
type: string | |
- name: backendAzureRmResourceGroupName | |
type: string | |
- name: backendAzureRmStorageAccountName | |
type: string | |
- name: backendAzureRmContainerName | |
type: string | |
- name: backendAzureRmKey | |
type: string | |
- name: tfComponent | |
type: string | |
- name: tfExecutionDir | |
type: string | |
- name: tfVarFileName | |
type: string | |
steps: | |
- task: Cache@2 | |
displayName: Register TF cache | |
inputs: | |
key: terraform | $(Agent.OS) | "$(Build.BuildNumber)" | $(Build.SourceVersion) | "$(Build.BuildNumber)" | ${{ parameters.tfComponent }} | "${{ parameters.tfVarFileName }}" | |
path: '${{ parameters.tfExecutionDir }}' | |
- task: TerraformInstaller@0 | |
displayName: 'Install Terraform v$(terraformVersion)' | |
inputs: | |
terraformVersion: '$(terraformVersion)' | |
- task: TerraformTaskV1@0 | |
displayName: 'Terraform Init' | |
inputs: | |
provider: 'azurerm' | |
command: 'init' | |
workingDirectory: '${{ parameters.tfExecutionDir }}' | |
backendServiceArm: '${{ parameters.serviceConnectionName}}' | |
backendAzureRmResourceGroupName: '${{ parameters.backendAzureRmResourceGroupName }}' | |
backendAzureRmStorageAccountName: '${{ parameters.backendAzureRmStorageAccountName }}' | |
backendAzureRmContainerName: '${{ parameters.backendAzureRmContainerName }}' | |
backendAzureRmKey: '${{ parameters.backendAzureRmKey }}' | |
- task: TerraformTaskV1@0 | |
displayName: 'Run Terraform Plan' | |
inputs: | |
provider: 'azurerm' | |
command: 'plan' | |
commandOptions: '-var-file=${{ parameters.tfVarFileName }} -out=${BUILD_BUILDNUMBER}.tfplan' | |
workingDirectory: '${{ parameters.tfExecutionDir }}' | |
environmentServiceNameAzureRM: '${{ parameters.serviceConnectionName }}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment