-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBCDR-pipeline-Final.yml
51 lines (45 loc) · 1.26 KB
/
BCDR-pipeline-Final.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
trigger:
branches:
include:
- main
pool:
vmImage: 'ubuntu-latest'
variables:
TF_VERSION: 'latest'
TF_WORKING_DIR: 'terraform' # Adjust this path if needed
steps:
- task: TerraformInstaller@1
displayName: 'Install Terraform'
inputs:
terraformVersion: '$(TF_VERSION)'
- task: TerraformTaskV4@4
displayName: Terraform Init
inputs:
provider: 'azurerm'
command: 'init'
backendServiceArm: 'BCDR_Project_Connection'
backendAzureRmResourceGroupName: 'RG_GSU_BCDR'
backendAzureRmStorageAccountName: 'storagebcdr'
backendAzureRmContainerName: 'bcdrcontainer'
backendAzureRmKey: 'terraform.tfstate'
- task: TerraformTaskV4@4
displayName: Terraform Plan
inputs:
provider: 'azurerm'
command: 'plan'
environmentServiceNameAzureRM: 'BCDR_Project_Connection'
- task: TerraformTaskV4@4
displayName: Terraform Apply
inputs:
provider: 'azurerm'
command: 'apply'
environmentServiceNameAzureRM: 'BCDR_Project_Connection'
- task: PublishPipelineArtifact@1
displayName: 'Publish pipeline artifact'
inputs:
targetPath: '$(Pipeline.Workspace)'
${{ if eq(variables['Build.SourceBranchName'], 'main') }}:
artifact: 'prod'
${{ else }}:
artifact: 'dev'
publishLocation: 'pipeline'