Repository navigation
Expand file tree
/
Copy pathexpanded-pipeline.yml
More file actions
119 lines (118 loc) · 3.91 KB
/
Copy pathexpanded-pipeline.yml
File metadata and controls
119 lines (118 loc) · 3.91 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
## This for demonstration prupose only and is the extract of the fully expanded YAML pipeline file
## It may not be the most up-to-date version of the pipeline file
resources:
repositories:
- repository: templates
type: github
name: JFolberth/TheYAMLPipelineOne
endpoint: JFolberth
trigger:
branches:
include:
- main
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: s3account_tf_build
jobs:
- job: Publish_infrastructure
steps:
- task: PublishPipelineArtifact@1
displayName: 'Publish Pipeline Artifact infrastructure '
inputs:
targetPath: infrastructure
artifact: infrastructure
properties: ''
- job: buildTerraform_dev2
dependsOn: []
displayName: Build Terraform dev2
variables:
- name: backendServiceAws
value: awsdev2
- name: workingDirectory
value: infrastructure
- name: backendAwsBucket
value: jfmsterraformstate
- name: backendAwsRegion
value: us-east-1
steps:
- task: TerraformInstaller@1
displayName: install terraform
inputs:
terraformVersion: latest
- task: TerraformCLI@1
displayName: 'Terraform : init'
inputs:
command: init
backendType: aws
workingDirectory: infrastructure
backendServiceAws: awsdev2
backendAwsRegion: us-east-1
backendAwsBucket: jfmsterraformstate
backendAwsKey: s3account.tfstate
- task: TerraformCLI@1
displayName: 'Terraform : plan'
inputs:
command: plan
workingDirectory: infrastructure
publishPlanResults: CI - dev2 - s3account
providerServiceAws: awsdev2
providerAwsRegion: us-east-1
commandOptions: -lock=false -var-file="variables/dev2.eus.variables.tfvars" -out=$(System.DefaultWorkingDirectory)/terraform.tfplan -detailed-exitcode
- stage: s3account_dev2_eus_tf_apply
jobs:
- deployment: terraformApplydev2
displayName: Terraform Apply dev2
variables:
- name: backendServiceAws
value: awsdev2
- name: workingDirectory
value: infrastructure
- name: backendAwsBucket
value: jfmsterraformstate
- name: backendAwsRegion
value: us-east-1
- name: commandOptions
value: ''
environment:
name: dev2
strategy:
runOnce:
deploy:
steps:
- task: 30f35852-3f7e-4c0c-9a88-e127b4f97211@1
inputs:
alias: current
artifact: infrastructure
- task: TerraformInstaller@1
displayName: install terraform
inputs:
terraformVersion: latest
- task: TerraformCLI@1
displayName: 'Terraform : init'
inputs:
command: init
backendType: aws
workingDirectory: $(Pipeline.Workspace)/infrastructure
backendServiceAws: awsdev2
backendAwsRegion: us-east-1
backendAwsBucket: jfmsterraformstate
backendAwsKey: s3account.tfstate
- task: TerraformCLI@1
displayName: 'Terraform : plan'
inputs:
command: plan
workingDirectory: $(Pipeline.Workspace)/infrastructure
publishPlanResults: CI - dev2 - s3account
providerServiceAws: awsdev2
providerAwsRegion: us-east-1
commandOptions: -lock=false -var-file="variables/dev2.eus.variables.tfvars" -out=$(System.DefaultWorkingDirectory)/terraform.tfplan -detailed-exitcode
- task: TerraformCLI@1
displayName: 'Terraform : apply'
condition: and(succeeded(), eq(variables['TERRAFORM_PLAN_HAS_CHANGES'],'true'))
inputs:
command: apply
workingDirectory: $(Pipeline.Workspace)/infrastructure
commandOptions: '$(System.DefaultWorkingDirectory)/terraform.tfplan'
providerServiceAws: awsdev2
providerAwsRegion: us-east-1