Repository navigation
fix: Require object for CreationPolicy and UpdatePolicy - #4641
Merged
kddejong merged 1 commit intoAug 18, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4641 +/- ##
==========================================
+ Coverage 94.58% 94.61% +0.02%
==========================================
Files 432 432
Lines 15417 15426 +9
Branches 2986 2991 +5
==========================================
+ Hits 14582 14595 +13
+ Misses 456 453 -3
+ Partials 379 378 -1
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:
|
CreationPolicy and UpdatePolicy must resolve to an object. CloudFormation rejects a bare intrinsic standing in for the whole object with "Template format error: Expected an object" (verified against live CloudFormation). Only an object literal or Fn::If (which resolves to an object) is valid; Ref/Fn::Sub/Fn::FindInMap and Ref to a resource or pseudo parameter are not. Intrinsics nested at leaf properties (e.g. ResourceSignal.Count: !Ref P) remain valid. Changes: - allOf no longer flips unresolvable_function_mode or rolls errors up into a single "Cannot determine allOf". allOf is conjunctive (every subschema must hold, no branch selection), so an unresolvable intrinsic creates no ambiguity there; the suppression only hid legitimate errors (that mode belongs in the disjunctive keywords anyOf/oneOf/if). This lets UpdatePolicy (E3016), whose schema is expressed via allOf/if/then, surface these errors like CreationPolicy (E3055) already does. - E3055/E3016 validate against plain object schemas and blank Resources from the reference context so Ref to a resource is caught. - Ref (E1020) resolves pseudo-parameter types (string, or list for AWS::NotificationARNs) and validates them against the schema, mirroring the existing named-parameter check, so Ref to a pseudo at an object slot is caught. - Add integration templates and snapshots for CreationPolicy and UpdatePolicy. Known follow-up: Fn::Select is not yet rejected at the object slot because its declared output type is all_types (it can legitimately resolve to an object via a list of objects).
kddejong
force-pushed
the
fix/issue/creationpolicy
branch
from
August 18, 2026 14:31
5cb4c5f to
ea6590b
Compare
This was referenced Sep 3, 2026
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:
Description of changes:
CreationPolicyandUpdatePolicymust resolve to an object. CloudFormationrejects a bare intrinsic standing in for the whole object with
Template format error: Expected an object(verified against liveCloudFormation). Only an object literal or
Fn::If(which resolves to anobject) is valid there;
Ref/Fn::Sub/Fn::FindInMap, andRefto aresource or pseudo parameter, are not. Intrinsics nested at leaf properties
(e.g.
ResourceSignal.Count: !Ref Count) remain valid.Previously these were missed:
E3055/E3016allowed the full function set andleaned on type inference, and
UpdatePolicyerrors were swallowed entirely.Changes
allOfno longer flipsunresolvable_function_modeor rolls errors up into asingle "Cannot determine allOf".
allOfis conjunctive — every subschemamust hold and there is no branch to select — so an unresolvable intrinsic
creates no ambiguity there; the suppression only hid legitimate errors. That
mode still applies to the disjunctive keywords (
anyOf/oneOf/if). Thislets
UpdatePolicy(E3016), whose schema is expressed viaallOf/if/then,surface these errors the way
CreationPolicy(E3055) already does.Resourcesfromthe reference context, so
Refto a resource is caught.Ref(E1020) now resolves pseudo-parameter types (string, or list forAWS::NotificationARNs) and validates them against the schema, mirroring theexisting named-parameter check, so
Refto a pseudo at an object slot iscaught.
UpdatePolicy (
test/fixtures/templates/integration/,test/fixtures/results/integration/).Verified against live CloudFormation (CreateStack):
Fn::If(object branches)Ref(param / resource / pseudo),Fn::Sub,Fn::FindInMapExpected an objectRef: AWS::NoValueExpected an objectCount: !Ref P)Known follow-up:
Fn::Selectis not yet rejected at the object slotbecause its declared output type is
all_types(it can legitimately resolve toan object via a list of objects, e.g. through
Fn::FindInMap). Trackedseparately.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.