forked from MicrosoftDocs/mslearn-tailspin-spacegame-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines-deploy-plan-template.yml
57 lines (54 loc) · 1.82 KB
/
azure-pipelines-deploy-plan-template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Terraform CD pipeline template
parameters:
# unique name of the job
job_name: deploy_terraform
# friendly name of the job
display_name: 'Deploy with Terraform'
# build pipeline artifact name
artifact_name: 'SpaceGameWeb'
# build branch
build_branch: 'develop'
# pipeline variable group to use
variable_group_name: test_configuration
variables:
- group: ${{parameters.variable_group_name}}
- name: terraform_working_dir
value: './terraform'
- name: project_id
value: '17c7e148-5259-4c50-a78a-221a3542498f' # 'Pipelines Demo'
- name: pipeline_id
value: '19' # 'tailspin-spacegame-web-build'
steps:
- task: TerraformCLI@0
inputs:
command: 'init'
workingDirectory: '$(terraform_working_dir)'
commandOptions: '-backend-config=resource_group_name=$(RES_GRP) -backend-config=storage_account_name=$(STORAGE_ACCT) -backend-config=container_name=tf-statefiles -backend-config=key=$(state.key) -backend-config=access_key=$(ACCESS_KEY) -no-color -input=false'
backendType: 'azurerm'
- task: TerraformCLI@0
inputs:
workingDirectory: '$(terraform_working_dir)'
command: 'validate'
commandOptions: '-check-variables=false'
- task: TerraformCLI@0
inputs:
workingDirectory: '$(terraform_working_dir)'
command: 'plan'
environmentServiceName: '$(azure_subscription)'
commandOptions: '-out=tfplan.out -no-color -input=false -detailed-exitcode'
- task: Bash@3
inputs:
targetType: 'inline'
script: |
cd $(terraform_working_dir)
terraform show tfplan.out > tfplan.txt
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(terraform_working_dir)/tfplan.out'
artifact: 'tfplan_out'
publishLocation: 'pipeline'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(terraform_working_dir)/tfplan.txt'
artifact: 'tfplan_txt'
publishLocation: 'pipeline'