forked from cloudposse/terraform-null-label
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compatibility.tf
286 lines (234 loc) · 6.9 KB
/
compatibility.tf
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
####
# these tests ensure that new versions of null-label remain compatible and
# interoperable with old versions of null-label.
#
# However, there is a known incompatibility we are not going to do anything about:
#
# The input regex_replace_chars specifies a regular expression, and characters matching it are removed
# from labels/id elements. Prior to this release, if the delimiter itself matched the regular expression,
# then the delimiter would be removed from the attributes portion of the id. This was not a problem
# for most users, since the default delimiter was - (dash) and the default regex allowed dashes, but
# if you customized the delimiter and/or regex, it mattered. So these
# compatibility tests are required to allow the delimiter in the labels.
module "source_v22_full" {
source = "cloudposse/label/null"
version = "0.22.1"
enabled = true
namespace = "CloudPosse"
environment = "UAT"
stage = "build"
name = "Winston Churchroom"
delimiter = "+"
attributes = ["fire", "water"]
tags = {
City = "Dublin"
Environment = "Private"
}
additional_tag_map = {
propagate = true
}
label_order = ["name", "environment", "stage", "attributes"]
regex_replace_chars = "/[^a-tv-zA-Z0-9+]/" # Eliminate "u" just to verify this is taking effect
id_length_limit = 28
}
module "source_v22_empty" {
source = "cloudposse/label/null"
version = "0.22.1"
stage = "STAGE"
}
module "source_v24_full" {
source = "cloudposse/label/null"
version = "0.24.1"
enabled = true
namespace = "CloudPosse"
environment = "UAT"
stage = "build"
name = "Winston Churchroom"
delimiter = "+"
attributes = ["fire", "water"]
tags = {
City = "Dublin"
Environment = "Private"
}
additional_tag_map = {
propagate = true
}
label_order = ["name", "environment", "stage", "attributes"]
regex_replace_chars = "/[^a-tv-zA-Z0-9+]/" # Eliminate "u" just to verify this is taking effect
id_length_limit = 28
label_key_case = "upper"
label_value_case = "lower"
}
module "source_v24_empty" {
source = "cloudposse/label/null"
version = "0.24.1"
stage = "STAGE"
}
# When testing the backward compatibility of supplying a new
# context to an old module, it is not fair to use
# the new features in the new module.
module "source_v25_22_full" {
source = "../.."
enabled = true
namespace = "CloudPosse"
environment = "UAT"
stage = "build"
name = "Winston Churchroom"
delimiter = "+"
attributes = ["fire", "water"]
tags = {
City = "Dublin"
Environment = "Private"
}
additional_tag_map = {
propagate = true
}
label_order = ["name", "environment", "stage", "attributes"]
# Need to add "+" to the regex in v0.22.1 due to a known issue:
# the attributes string will have the delimiter stripped out
# if the delimiter is selected by `regex_replace_chars`.
# This was fixed in v0.24.1
regex_replace_chars = "/[^a-tv-zA-Z0-9+]/" # Eliminate "u" just to verify this is taking effect
id_length_limit = 28
}
module "source_v25_24_full" {
source = "../.."
regex_replace_chars = "/[^a-tv-zA-Z0-9]/" # Eliminate "u" just to verify this is taking effect
label_key_case = "lower"
label_value_case = "upper"
context = module.source_v25_22_full.context
}
module "source_v25_empty" {
source = "../.."
stage = "STAGE"
}
module "compat_22_25_full" {
source = "../.."
context = module.source_v22_full.context
}
module "compat_24_25_full" {
source = "../.."
context = module.source_v24_full.context
}
module "compat_22_25_empty" {
source = "../.."
context = module.source_v22_empty.context
}
module "compat_24_25_empty" {
source = "../.."
context = module.source_v24_empty.context
}
module "compat_25_22_full" {
source = "cloudposse/label/null"
version = "0.22.1"
# Known issue, additional_tag_map not taken from context
additional_tag_map = module.source_v25_22_full.context.additional_tag_map
context = module.source_v25_22_full.context
}
module "compat_25_24_full" {
source = "cloudposse/label/null"
version = "0.24.1"
# Known issue, additional_tag_map not taken from context
additional_tag_map = module.source_v25_22_full.context.additional_tag_map
context = module.source_v25_24_full.context
}
module "compat_25_22_empty" {
source = "cloudposse/label/null"
version = "0.22.1"
context = module.source_v25_empty.context
}
module "compat_25_24_empty" {
source = "cloudposse/label/null"
version = "0.24.1"
context = module.source_v25_empty.context
}
module "compare_22_25_full" {
source = "./module/compare"
a = module.source_v22_full
b = module.compat_22_25_full
}
output "compare_22_25_full" {
value = module.compare_22_25_full
}
/* Uncomment this code to see how the fields differ
output "source_22_full_id_full" {
value = module.source_v22_full.id_full
}
output "compat_22_25_full_id_full" {
value = module.compat_22_25_full.id_full
}
output "source_22_full_talm" {
value = module.source_v22_full.tags_as_list_of_maps
}
output "compat_22_25_full_talm" {
value = module.compat_22_25_full.tags_as_list_of_maps
}
*/
module "compare_24_25_full" {
source = "./module/compare"
a = module.source_v24_full
b = module.compat_24_25_full
}
output "compare_24_25_full" {
value = module.compare_24_25_full
}
module "compare_22_25_empty" {
source = "./module/compare"
a = module.source_v22_empty
b = module.compat_22_25_empty
}
output "compare_22_25_empty" {
value = module.compare_22_25_empty
}
module "compare_24_25_empty" {
source = "./module/compare"
a = module.source_v24_empty
b = module.compat_24_25_empty
}
output "compare_24_25_empty" {
value = module.compare_24_25_empty
}
module "compare_25_22_full" {
source = "./module/compare"
a = module.source_v25_22_full
b = module.compat_25_22_full
}
output "compare_25_22_full" {
value = module.compare_25_22_full
}
module "compare_25_24_full" {
source = "./module/compare"
a = module.source_v25_24_full
b = module.compat_25_24_full
}
output "compare_25_24_full" {
value = module.compare_25_24_full
}
module "compare_25_22_empty" {
source = "./module/compare"
a = module.source_v25_empty
b = module.compat_25_22_empty
}
output "compare_25_22_empty" {
value = module.compare_25_22_empty
}
module "compare_25_24_empty" {
source = "./module/compare"
a = module.source_v25_empty
b = module.compat_25_24_empty
}
output "compare_25_24_empty" {
value = module.compare_25_24_empty
}
output "compatible" {
value = (
module.compare_22_25_full.equal &&
module.compare_24_25_full.equal &&
module.compare_25_22_full.equal &&
module.compare_25_24_full.equal &&
module.compare_22_25_empty.equal &&
module.compare_24_25_empty.equal &&
module.compare_25_22_empty.equal &&
module.compare_25_24_empty.equal
)
}