Skip to content

Commit 78e7d9f

Browse files
authored
Allow for vCPU and GB in ECS tasks (#3515)
* Allow for vCPU and GB in ECS tasks * Update the variances of memory with GB
1 parent 0dd93b2 commit 78e7d9f

File tree

4 files changed

+267
-54
lines changed

4 files changed

+267
-54
lines changed

src/cfnlint/data/schemas/extensions/aws_ecs_taskdefinition/fargate_cpu_memory.json

+198-39
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,27 @@
3434
{
3535
"properties": {
3636
"Cpu": {
37-
"enum": [
38-
"256"
39-
]
37+
"else": {
38+
"pattern": "^\\.25\\s*(?i)vCpu$"
39+
},
40+
"if": {
41+
"pattern": "^\\d+$",
42+
"type": [
43+
"integer",
44+
"string"
45+
]
46+
},
47+
"then": {
48+
"enum": [
49+
"256"
50+
]
51+
}
4052
},
4153
"Memory": {
4254
"enum": [
55+
"0.5 GB",
56+
"1 GB",
57+
"2 GB",
4358
"512",
4459
"1024",
4560
"2048"
@@ -50,84 +65,228 @@
5065
{
5166
"properties": {
5267
"Cpu": {
53-
"enum": [
54-
"512"
55-
]
68+
"else": {
69+
"pattern": "^\\.5\\s*(?i)vCpu$"
70+
},
71+
"if": {
72+
"pattern": "^\\d+$",
73+
"type": [
74+
"integer",
75+
"string"
76+
]
77+
},
78+
"then": {
79+
"enum": [
80+
"512"
81+
]
82+
}
5683
},
5784
"Memory": {
58-
"maximum": 4096,
59-
"minimum": 1024,
60-
"multipleOf": 1024
85+
"else": {
86+
"pattern": "^(1|2|3|4)\\s*(?i)GB$"
87+
},
88+
"if": {
89+
"pattern": "^\\d+$",
90+
"type": [
91+
"integer",
92+
"string"
93+
]
94+
},
95+
"then": {
96+
"maximum": 4096,
97+
"minimum": 1024,
98+
"multipleOf": 1024
99+
}
61100
}
62101
}
63102
},
64103
{
65104
"properties": {
66105
"Cpu": {
67-
"enum": [
68-
"1024"
69-
]
106+
"else": {
107+
"pattern": "^1\\s*(?i)vCpu$"
108+
},
109+
"if": {
110+
"pattern": "^\\d+$",
111+
"type": [
112+
"integer",
113+
"string"
114+
]
115+
},
116+
"then": {
117+
"enum": [
118+
"1024"
119+
]
120+
}
70121
},
71122
"Memory": {
72-
"maximum": 8192,
73-
"minimum": 2048,
74-
"multipleOf": 1024
123+
"else": {
124+
"pattern": "^(2|3|4|5|6|7|8)\\s*(?i)GB$"
125+
},
126+
"if": {
127+
"pattern": "^\\d+$",
128+
"type": [
129+
"integer",
130+
"string"
131+
]
132+
},
133+
"then": {
134+
"maximum": 8192,
135+
"minimum": 2048,
136+
"multipleOf": 1024
137+
}
75138
}
76139
}
77140
},
78141
{
79142
"properties": {
80143
"Cpu": {
81-
"enum": [
82-
"2048"
83-
]
144+
"else": {
145+
"pattern": "^2\\s*(?i)vCpu$"
146+
},
147+
"if": {
148+
"pattern": "^\\d+$",
149+
"type": [
150+
"integer",
151+
"string"
152+
]
153+
},
154+
"then": {
155+
"enum": [
156+
"2048"
157+
]
158+
}
84159
},
85160
"Memory": {
86-
"maximum": 16384,
87-
"minimum": 4096,
88-
"multipleOf": 1024
161+
"else": {
162+
"pattern": "^(4|5|6|7|8|9|10|11|12|13|14|15|16)\\s*(?i)GB$"
163+
},
164+
"if": {
165+
"pattern": "^\\d+$",
166+
"type": [
167+
"integer",
168+
"string"
169+
]
170+
},
171+
"then": {
172+
"maximum": 16384,
173+
"minimum": 4096,
174+
"multipleOf": 1024
175+
}
89176
}
90177
}
91178
},
92179
{
93180
"properties": {
94181
"Cpu": {
95-
"enum": [
96-
"4096"
97-
]
182+
"else": {
183+
"pattern": "^4\\s*(?i)vCpu$"
184+
},
185+
"if": {
186+
"pattern": "^\\d+$",
187+
"type": [
188+
"integer",
189+
"string"
190+
]
191+
},
192+
"then": {
193+
"enum": [
194+
"4096"
195+
]
196+
}
98197
},
99198
"Memory": {
100-
"maximum": 30720,
101-
"minimum": 8192,
102-
"multipleOf": 1024
199+
"else": {
200+
"pattern": "^(8|9|1[0-9]|2[0-9]|30)\\s*(?i)GB$"
201+
},
202+
"if": {
203+
"pattern": "^\\d+$",
204+
"type": [
205+
"integer",
206+
"string"
207+
]
208+
},
209+
"then": {
210+
"maximum": 30720,
211+
"minimum": 8192,
212+
"multipleOf": 1024
213+
}
103214
}
104215
}
105216
},
106217
{
107218
"properties": {
108219
"Cpu": {
109-
"enum": [
110-
"8192"
111-
]
220+
"else": {
221+
"pattern": "^8\\s*(?i)vCpu$"
222+
},
223+
"if": {
224+
"pattern": "^\\d+$",
225+
"type": [
226+
"integer",
227+
"string"
228+
]
229+
},
230+
"then": {
231+
"enum": [
232+
"8192"
233+
]
234+
}
112235
},
113236
"Memory": {
114-
"maximum": 61440,
115-
"minimum": 16384,
116-
"multipleOf": 4096
237+
"else": {
238+
"pattern": "^(16|20|24|28|32|36|40|44|48|52|56|60)\\s*(?i)GB$"
239+
},
240+
"if": {
241+
"pattern": "^\\d+$",
242+
"type": [
243+
"integer",
244+
"string"
245+
]
246+
},
247+
"then": {
248+
"maximum": 61440,
249+
"minimum": 16384,
250+
"multipleOf": 4096
251+
}
117252
}
118253
}
119254
},
120255
{
121256
"properties": {
122257
"Cpu": {
123-
"enum": [
124-
"16384"
125-
]
258+
"else": {
259+
"pattern": "^16\\s*(?i)vCpu$"
260+
},
261+
"if": {
262+
"pattern": "^\\d+$",
263+
"type": [
264+
"integer",
265+
"string"
266+
]
267+
},
268+
"then": {
269+
"enum": [
270+
"16384"
271+
]
272+
}
126273
},
127274
"Memory": {
128-
"maximum": 122880,
129-
"minimum": 32768,
130-
"multipleOf": 8192
275+
"else": {
276+
"pattern": "^(32|40|48|56|64|72|80|88|96|104|112|120)\\s*(?i)GB$"
277+
},
278+
"if": {
279+
"pattern": "^\\d+$",
280+
"type": [
281+
"integer",
282+
"string"
283+
]
284+
},
285+
"then": {
286+
"maximum": 122880,
287+
"minimum": 32768,
288+
"multipleOf": 8192
289+
}
131290
}
132291
}
133292
}

src/cfnlint/data/schemas/extensions/aws_ecs_taskdefinition/fargate_properties.json

+21-9
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,27 @@
4141
"then": {
4242
"properties": {
4343
"Cpu": {
44-
"enum": [
45-
"256",
46-
"512",
47-
"1024",
48-
"2048",
49-
"4096",
50-
"8192",
51-
"16384"
52-
]
44+
"else": {
45+
"pattern": "^(\\.25|\\.5|1|2|4|8|16)\\s*(?i)vCpu$"
46+
},
47+
"if": {
48+
"pattern": "^\\d+$",
49+
"type": [
50+
"integer",
51+
"string"
52+
]
53+
},
54+
"then": {
55+
"enum": [
56+
"256",
57+
"512",
58+
"1024",
59+
"2048",
60+
"4096",
61+
"8192",
62+
"16384"
63+
]
64+
}
5365
}
5466
}
5567
}

0 commit comments

Comments
 (0)