forked from GoogleCloudPlatform/cloud-foundation-fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelivery-pipeline.tf
More file actions
157 lines (132 loc) · 5.14 KB
/
delivery-pipeline.tf
File metadata and controls
157 lines (132 loc) · 5.14 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/**
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
resource "google_clouddeploy_delivery_pipeline" "default" {
project = var.project_id
location = var.region
name = var.name
annotations = var.annotations
description = var.description
labels = var.labels
suspended = var.suspended
dynamic "serial_pipeline" {
for_each = lower(local.pipeline_type) == "serial" ? [""] : []
content {
dynamic "stages" {
for_each = {
for k, v in var.targets :
k => v if v.exclude_from_pipeline == false
}
iterator = et
content {
profiles = et.value.profiles
target_id = et.value.name
dynamic "deploy_parameters" {
for_each = {
for k, v in et.value.delivery_pipeline_deploy_parameters :
k => v
}
iterator = edp
content {
match_target_labels = edp.value.matching_target_labels
values = edp.value.values
}
}
dynamic "strategy" {
for_each = et.value.strategy == null ? [] : [""]
content {
dynamic "canary" {
for_each = upper(et.value.strategy) == "CANARY" ? [""] : []
content {
canary_deployment {
percentages = et.value.deployment_percentages
verify = et.value.verify
dynamic "postdeploy" {
for_each = et.value.postdeploy_actions == null ? [] : [""]
content {
actions = et.value.postdeploy_actions
}
}
dynamic "predeploy" {
for_each = et.value.predeploy_actions == null ? [] : [""]
content {
actions = et.value.predeploy_actions
}
}
}
dynamic "custom_canary_deployment" {
for_each = length(et.value.custom_canary_phase_configs) > 0 ? [""] : []
content {
dynamic "phase_configs" {
for_each = et.value.custom_canary_phase_configs
iterator = epc
content {
percentage = epc.value.percentage
phase_id = epc.key
verify = epc.value.verify
dynamic "postdeploy" {
for_each = epc.value.postdeploy_actions == null ? [] : [""]
content {
actions = epc.value.postdeploy_actions
}
}
dynamic "predeploy" {
for_each = epc.value.predeploy_actions == null ? [] : [""]
content {
actions = epc.value.predeploy_actions
}
}
}
}
}
}
runtime_config {
dynamic "cloud_run" {
for_each = et.value.cloud_run_configs == null ? [] : [""]
content {
automatic_traffic_control = et.value.cloud_run_configs.automatic_traffic_control
canary_revision_tags = et.value.cloud_run_configs.canary_revision_tags
prior_revision_tags = et.value.cloud_run_configs.prior_revision_tags
stable_revision_tags = et.value.cloud_run_configs.stable_revision_tags
}
}
}
}
}
dynamic "standard" {
for_each = upper(et.value.strategy) == "STANDARD" ? [""] : []
content {
verify = et.value.verify
dynamic "postdeploy" {
for_each = et.value.postdeploy_actions == null ? [] : [""]
content {
actions = et.value.postdeploy_actions
}
}
dynamic "predeploy" {
for_each = et.value.predeploy_actions == null ? [] : [""]
content {
actions = et.value.predeploy_actions
}
}
}
}
}
}
}
}
}
}
}