-
Notifications
You must be signed in to change notification settings - Fork 0
/
terraform-apply.yml
79 lines (71 loc) · 2.21 KB
/
terraform-apply.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
parameters:
- name: destroy
default: false
type: boolean
steps:
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Pipeline.Workspace)'
artifact: 'drop'
publishLocation: 'pipeline'
- task: TerraformInstaller@0
inputs:
terraformVersion: '0.13.0'
- task: TerraformTaskV1@0
name: 'Init'
inputs:
provider: 'azurerm'
command: 'init'
backendServiceArm: 'PAYG Dev Test'
backendAzureRmResourceGroupName: 'rg-coreinfrastructure-prod'
backendAzureRmStorageAccountName: 'stinteliontf'
backendAzureRmContainerName: 'terraformstate'
backendAzureRmKey: 'azuredevopsbootstrap'
- task: TerraformTaskV1@0
name: 'Plan'
inputs:
provider: 'azurerm'
command: 'plan'
environmentServiceNameAzureRM: 'PAYG Dev Test'
env:
AZDO_PERSONAL_ACCESS_TOKEN: $(AZDO_PERSONAL_ACCESS_TOKEN)
TF_VAR_subscription_id: $(SUBSCRIPTION_ID)
TF_VAR_subscription_name: $(SUBSCRIPTION_NAME)
TF_VAR_tenant_id: $(TENANT_ID)
TF_VAR_project_admin_user_email: $(project_admin_user_email)
TF_VAR_project_name: $(project_name)
TF_VAR_repo_name: $(repo_name)
- task: TerraformTaskV1@0
name: 'Apply'
condition: eq('${{ parameters.destroy }}', false)
inputs:
provider: 'azurerm'
command: 'apply'
environmentServiceNameAzureRM: 'PAYG Dev Test'
env:
AZDO_PERSONAL_ACCESS_TOKEN: $(AZDO_PERSONAL_ACCESS_TOKEN)
TF_VAR_subscription_id: $(SUBSCRIPTION_ID)
TF_VAR_subscription_name: $(SUBSCRIPTION_NAME)
TF_VAR_tenant_id: $(TENANT_ID)
TF_VAR_project_admin_user_email: $(project_admin_user_email)
TF_VAR_project_name: $(project_name)
TF_VAR_repo_name: $(repo_name)
- task: TerraformTaskV1@0
name: 'Destroy'
condition: eq('${{ parameters.destroy }}', true)
inputs:
provider: 'azurerm'
command: 'destroy'
environmentServiceNameAzureRM: 'PAYG Dev Test'
env:
AZDO_PERSONAL_ACCESS_TOKEN: $(AZDO_PERSONAL_ACCESS_TOKEN)
TF_VAR_subscription_id: $(SUBSCRIPTION_ID)
TF_VAR_subscription_name: $(SUBSCRIPTION_NAME)
TF_VAR_tenant_id: $(TENANT_ID)
TF_VAR_project_admin_user_email: $(project_admin_user_email)
TF_VAR_project_name: $(project_name)
TF_VAR_repo_name: $(repo_name)