Skip to content

Commit 4c5129b

Browse files
juliocckarpok78
authored andcommitted
Allow addons to any flex stage 2 (GoogleCloudPlatform#2853)
1 parent c8ebcf7 commit 4c5129b

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

fast/stages/1-resman/variables-addons.tf

+15-5
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ variable "fast_addon" {
3131
default = {}
3232
validation {
3333
condition = alltrue([
34-
for k, v in var.fast_addon : contains(
35-
["2-networking", "2-project-factory", "2-security"],
36-
v.parent_stage
37-
)
34+
for k, v in var.fast_addon :
35+
startswith(v.parent_stage, "2-")
3836
])
39-
error_message = "Resman-defined addons only support '2-networking', '2-project-factory' and '2-security' stages."
37+
error_message = "The parent stage of resman-defined addons should match '2-<stage2-name>'."
4038
}
4139
validation {
4240
condition = alltrue([
@@ -49,3 +47,15 @@ variable "fast_addon" {
4947
error_message = "Invalid CI/CD repository type."
5048
}
5149
}
50+
51+
check "addons_parent_stage" {
52+
assert {
53+
condition = alltrue([
54+
for k, v in var.fast_addon : contains(
55+
[for x in keys(local.stage2) : "2-${x}"],
56+
v.parent_stage
57+
)
58+
])
59+
error_message = "Resman-defined addons only support stage 2 as parents."
60+
}
61+
}

0 commit comments

Comments
 (0)