-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
57 lines (47 loc) · 1.77 KB
/
azure-pipelines.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
trigger:
none
pool:
vmImage: 'ubuntu-latest'
variables:
name: "ants"
rgLocation: "westeurope"
steps:
- task: AzureCLI@2
displayName: Ensure Azure Storage backend for Terraform
inputs:
azureSubscription: MySubscription
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
source create-account-for-tf-state.sh
echo "##vso[task.setvariable variable=tfBackendRg]$RESOURCE_GROUP"
echo "##vso[task.setvariable variable=tfBackendAccount]$STORAGE_ACCOUNT"
echo "##vso[task.setvariable variable=tfBackendContainer]$CONTAINER"
- task: ms-devlabs.custom-terraform-tasks.custom-terraform-release-task.TerraformTaskV1@0
displayName: Initialize Terraform template
inputs:
command: init
backendServiceArm: MySubscription
backendAzureRmResourceGroupName: $(tfBackendRg)
backendAzureRmStorageAccountName: $(tfBackendAccount)
backendAzureRmContainerName: $(tfBackendContainer)
backendAzureRmKey: terraform.tfstate
- bash: |
TF_VARS="-var=name=$(name) \
-var=rg_location=$(rgLocation) \
-var=rg_name=$(tfBackendRg)"
echo "##vso[task.setvariable variable=tfVars]-lock-timeout=5m $TF_VARS"
displayName: Set Terraform Variables
- task: ms-devlabs.custom-terraform-tasks.custom-terraform-release-task.TerraformTaskV1@0
displayName: Plan Terraform template
inputs:
command: plan
commandOptions: $(tfVars)
environmentServiceNameAzureRM: MySubscription
- task: ms-devlabs.custom-terraform-tasks.custom-terraform-release-task.TerraformTaskV1@0
name: applyStep
displayName: Apply Terraform template
inputs:
command: apply
commandOptions: $(tfVars)
environmentServiceNameAzureRM: MySubscription