Last active
April 12, 2020 16:00
-
-
Save rudolphjacksonm/c764842ac03740ba4307d702b0b8c18d 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.SourceVersion) | ${{ 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