Repository navigation
fix(E1011): skip FindInMap key errors when the key comes from a pseudo parameter - #5011
Merged
kddejong merged 2 commits intoNov 10, 2026
Conversation
…o parameter Fixes aws-cloudformation#5010 A Fn::FindInMap top-level key built from a pseudo parameter, for example Fn::Sub '${AWS::AccountId}-${AWS::Region}', only resolves to lint-time placeholder values (AWS::AccountId is always 123456789012 at lint time), so it can never match the real deploy-time keys in the mapping. Since 1.60.0 (aws-cloudformation#4919) that produced false positives under the parent rules in unconstrained positions (E8003 in a condition, E1022 in Fn::Join, E6101 in an output) as well as E1011 in constrained positions. Resolve the top-level key with pseudo parameters disabled, the same treatment the second-level key already gets in the same function, so such keys yield neither a value nor an error. Literal keys and keys resolved from parameters are unaffected, and hardcoded bad keys are still reported. Tests: 9 new cases covering Sub (AccountId alone, AccountId with Region, Region alone) and Join key shapes at the resolver and rule levels, in both constrained and unconstrained paths, plus a control showing a literal Sub key is still reported. The new cases fail on the pre-fix tree and pass after. Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
Contributor
Author
|
Hi, this PR is ready for review. The CI run is waiting on first-time-contributor workflow approval, could a maintainer approve it when you get a chance? Thanks. |
MauroRomer
approved these changes
Nov 10, 2026
kddejong
requested changes
Nov 10, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5011 +/- ##
=======================================
Coverage 94.81% 94.81%
=======================================
Files 441 441
Lines 16188 16189 +1
Branches 3140 3140
=======================================
+ Hits 15349 15350 +1
Misses 463 463
Partials 376 376
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5010
A Fn::FindInMap top-level key built from a pseudo parameter, for example Fn::Sub '${AWS::AccountId}-${AWS::Region}', only resolves to lint-time placeholder values (AWS::AccountId is always 123456789012 at lint time), so it can never match the real deploy-time keys in the mapping. Since 1.60.0 (#4919) that produced false positives under the parent rules in unconstrained positions (E8003 in a condition, E1022 in Fn::Join, E6101 in an output) as well as E1011 in constrained positions.
Resolve the top-level key with pseudo parameters disabled, the same treatment the second-level key already gets in the same function, so such keys yield neither a value nor an error. Literal keys and keys resolved from parameters are unaffected, and hardcoded bad keys are still reported.
Tests: 9 new cases covering Sub (AccountId alone, AccountId with Region, Region alone) and Join key shapes at the resolver and rule levels, in both constrained and unconstrained paths, plus a control showing a literal Sub key is still reported. The new cases fail on the pre-fix tree and pass after.