-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yaml
102 lines (92 loc) · 2.79 KB
/
azure-pipelines.yaml
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
resources:
repositories:
- repository: templates
type: github
name: hmcts/azure-devops-templates
ref: refs/heads/master
endpoint: hmcts
- repository: vh-setup
type: github
name: hmcts/vh-setup
ref: refs/heads/main
endpoint: hmcts
pr:
branches:
include:
- master
paths:
exclude:
- terraform/10-video-hearing-wowza/*
pool:
vmImage: ubuntu-22.04
trigger:
branches:
include:
- master
paths:
exclude:
- terraform/10-video-hearing-wowza/*
parameters:
- name: environment
type: object
default:
- name: Dev
dependsOnEnv: ""
- name: Demo
dependsOnEnv: "Dev"
- name: ITHC
dependsOnEnv: "Dev"
- name: Stg
dependsOnEnv: "Dev"
- name: Test
dependsOnEnv: "Dev"
- name: Prod
dependsOnEnv: "Stg"
variables:
- name: tfVersion
value: 1.6.6
- group: external
- name: azureLocation
value: 'UK South'
stages:
################################################
# Validate Infra Code. #########################
- stage: Validate_Terraform_Code
displayName: 'Validate Terraform Code'
jobs:
- job: Validate_Terraform_Code
displayName: Validate Terraform Code
steps:
- checkout: self
- checkout: vh-setup
- template: pipeline-steps/terraform-validate.yaml
parameters:
tfversion: ${{ variables.tfversion }}
################################################
# Terraform Plan & Apply. ######################
- ${{ each env in parameters.environment }}:
# - ${{ if and( eq(env.name, 'Dev'), contains(variables['Build.SourceBranch'], 'refs/pull')) }}:
- ${{ if eq(env.name, 'Dev') }}:
- template: pipeline-steps/terraform-plan-apply.yaml
parameters:
terraformVersion: ${{ variables.tfVersion }}
env: ${{ env.name }}
location: ${{ variables.azureLocation }}
environmentServiceConnection: DTS-SHAREDSERVICES-${{ env.name }}-Video Hearings
product: vh
activityName: Video_Hearing_Core
tfStateResourceGroup: vh-infra-core-${{ env.name }}-tf
tfStateStorageAccountName: vhinfracore${{ env.name }}tf
dependsOnEnv: ${{ env.dependsOnEnv }}
- ${{ elseif eq(variables['Build.SourceBranchName'], 'master') }}:
- template: pipeline-steps/terraform-plan-apply.yaml
parameters:
terraformVersion: ${{ variables.tfVersion }}
env: ${{ env.name }}
location: ${{ variables.azureLocation }}
environmentServiceConnection: DTS-SHAREDSERVICES-${{ env.name }}-Video Hearings
product: vh
activityName: Video_Hearing_Core
tfStateResourceGroup: vh-infra-core-${{ env.name }}-tf
tfStateStorageAccountName: vhinfracore${{ env.name }}tf
dependsOnEnv: ${{ env.dependsOnEnv }}