Repository navigation
Conversation
kddejong
force-pushed
the
fix/e3006-partition-conditions
branch
from
November 3, 2026 21:59
f18aded to
6a4dad0
Compare
build_scenerios_on_region already fixes Equals against Ref AWS::Region. The partition is a function of the region, so the same Equals against Ref AWS::Partition can be fixed at the same time instead of being left as [True, False]. E3006 reads it, so a resource gated on a partition condition is no longer reported as missing from regions where the condition is false. Signed-off-by: Brenden Hogan <hoganbr@amazon.com>
kddejong
force-pushed
the
fix/e3006-partition-conditions
branch
from
November 3, 2026 22:56
6a4dad0 to
069935c
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4982 +/- ##
=======================================
Coverage 94.80% 94.80%
=======================================
Files 441 441
Lines 16128 16144 +16
Branches 3130 3132 +2
=======================================
+ Hits 15290 15306 +16
Misses 463 463
Partials 375 375
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.
Issue #, if available: Fixes #4981
Description of changes:
This PR is stacked on #4980 (and through it on #4976 and #4978) and shows their commits until they merge; the change here is the last commit. It needs
get_partitionfrom #4980.Conditions.build_scenerios_on_regiondecides anFn::EqualsbetweenRef AWS::Regionand a literal for the region being linted. AnFn::EqualsagainstRef AWS::Partitionstays[True, False], even though the region fixes the partition. So E3006 reports a resource as missing from a region where its condition can never be true:cfn-lint --regions us-east-1 cn-north-1 us-gov-west-1onmain:With this change neither is reported. The same resource gated on
!Equals [aws-cn, !Ref AWS::Partition]still gets E3006 forcn-north-1.Equalgains anis_partitionproperty, computed by the same helper asis_region.build_scenerios_on_regiondecides those equals fromget_partition(region)(added in #4980). Only literal comparisons are decided:!Equals [!Ref AWS::Partition, !Ref SomeParameter]stays undecided.Reach.
build_scenerios_on_regionis called by E3006 and byConditions.build_scenarioswhen it is given a region. No other bundled rule passes a region, so E3006 is the only rule whose output changes. It can only drop findings, in regions where a partition condition is false. The context-path conditions (cfnlint.context.conditions) are unchanged; theiris_regionhas no caller outside that package, soFn::Ifresolution is not affected.Verification.
test_equals.py:EqualrecognisesRef AWS::Partitionon either side and leaves region and parameter equals alone.test_conditions.py: the region decides the partition equals, including underFn::Not,Fn::AndandFn::Orand combined with a region equals, while parameter conditions stay undecided.test_type.py: E3006 run on a decoded template (not a mockedconditions) with a partition condition reports only the region where the condition holds.pytest testandpre-commit run --all-filespass.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.