Commit 840854d
committed
fix: don't error on invalid FindInMap in false-condition resources
CloudFormation skips all validation for resources with false conditions,
including Fn::FindInMap lookups against non-existent mapping keys.
_partial_resolve_find_in_map was re-raising InvalidTemplateException
for string-literal keys that don't exist in Mappings, causing SAM CLI
to reject valid templates that CloudFormation would accept.
Now returns the partially-resolved FindInMap form instead of erroring,
matching CloudFormation's behavior.
Also updated LanguageExtensionResult docstring to accurately document
the no-LE path aliasing contract (expanded_template and
original_template share the same reference when had_language_extensions
is False).
Moved templateFnInMapInWhenFalseConditionInResourceWithInvalidStringPath
from ERROR_TEMPLATES_PASSING to SUCCESS_TEMPLATES_PASSING in the Kotlin
compatibility tests, with expected output.1 parent 529f1cb commit 840854d
4 files changed
Lines changed: 46 additions & 8 deletions
File tree
- samcli/lib/cfn_language_extensions
- tests/unit/lib/cfn_language_extensions/compatibility
- templates
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
323 | 322 | | |
324 | | - | |
325 | | - | |
| 323 | + | |
326 | 324 | | |
327 | 325 | | |
328 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
| |||
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
196 | 195 | | |
197 | 196 | | |
198 | 197 | | |
| |||
311 | 310 | | |
312 | 311 | | |
313 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
314 | 316 | | |
315 | 317 | | |
316 | 318 | | |
| |||
0 commit comments