Repository navigation
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2074 +/- ##
==========================================
- Coverage 92.08% 92.05% -0.04%
==========================================
Files 83 83
Lines 13246 13246
Branches 1886 1884 -2
==========================================
- Hits 12197 12193 -4
- Misses 1011 1015 +4
Partials 38 38
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:
|
…FormationTemplate
Opt-in props, off for hotswap:
- strictValues: CloudFormation value semantics (empty strings are values, null is missing),
Fn::Select out of range is an evaluation failure, Fn::Sub handles ${!Literal}
- unavailableParameters: a Ref to one fails instead of falling back to its Default
- lookups (SharedLookups): Cloud Control reads cached per resource and limited across evaluators,
nested stack outputs read from DescribeStacks
Changes that also apply to hotswap (error handling only):
- unsupported functions throw CfnUnsupportedFunctionException (a CfnEvaluationException, same message)
- failed Cloud Control lookups keep the original error as the cause
- a Cloud Control identifier that can't be evaluated throws its own evaluation error; other errors
while building it are still wrapped in a CfnEvaluationException
- Fn::GetAtt of a nested stack output when the nested template has no Outputs is an evaluation failure,
not a TypeError
- parseIntrinsic is exported for reuse
Remove the strictValues option and make its semantics the default:
- an empty string (or 0, false) is a value; only a missing or null value is missing
- Fn::Select with an index out of range is an evaluation failure
- ${!Literal} in Fn::Sub is the literal text ${Literal}
For hotswap, each of these either replaces a wrong value with the correct one (an empty-string parameter
no longer falls back to its Default; Fn::Select out of range no longer becomes an empty string) or turns a
case that fell back to a full deployment into a hotswap with the correct value ("", 0 or false attributes,
${!Literal}). A null attribute is still missing.
…nd evaluate the Fn::Select index - reading a nested stack's outputs through shared lookups requires its physical id: a nested stack that has not been created is an evaluation failure, instead of DescribeStacks without a stack name (which lists every stack and returned the first one's outputs) - Fn::Select evaluates its index (Ref, Fn::FindInMap), accepts numeric strings, and requires an integer - create the CloudFormation client once per evaluator; one nested-stack-outputs branch; isValue is a module-level helper
…ndexes the way CloudFormation does
- A Cloud Control identifier part set to '', 0 or false in the template is used, not replaced by the physical id
- Fn::Sub placeholders, parameters, Cloud Control attributes and deployed nested stack outputs only match their
own keys, so names like `constructor` and `toString` are evaluation failures instead of functions
- A string Fn::Select index must be a plain non-negative integer ('0x1', '1e0', ' 1 ' are rejected)
- Fix the spacing and spelling of the failed Cloud Control lookup message
- Share the Cloud Control response parsing between the evaluator and SharedLookups, reuse the cached
CloudFormation client for DescribeType, and compute the lookup scope once
… stack output lookups
|
Automated review A maintainer will still review this — treat the notes below as a starting point. 📌 Commit This PR extends 🔴 0 blocking · 🟡 0 recommended · ⚪ 0 optional Generated automatically. React 👍 or 👎 to tell us whether this review helped, so we can improve these reviews. |
|
See the output template (account ID redacted) |
First of several stacked PRs, which eventually add an unstable
evaluateaction to toolkit-lib (#2066).Extends and improves functionality of our template evaluator.
Description of changes
New opt-in props on
EvaluateCloudFormationTemplate. Hotswap doesn't set these props.unavailableParameters: aRefto one of these parameters (e.g. NoEcho parameters, whose deployed values are masked) fails instead of falling back to the parameter'sDefault, including where the evaluator uses it internally (Cloud Control identifiers, nested stack parameters).lookups(newSharedLookupsclass): Cloud Control reads are cached per resource and limited to a number in flight across all evaluators that share it, and nested stack outputs are read fromDescribeStacksof the deployed nested stack (by its physical id), instead of evaluated from its template.Changes that also apply to hotswap:
0,false) is a value and only a missing ornullvalue is missing.CfnUnsupportedFunctionException.cause.Fn::GetAttof a nested stack output when the nested template has noOutputssection is an evaluation failure instead of aTypeError(which failed the hotswap deployment).Describe any new or updated permissions being added
None.
Description of how you validated changes
nullattribute is still missing, and errors while building a Cloud Control identifier still come back asCfnEvaluationException.Deployed a CDK app containing several resources that test our resolver logic. See code below:
Ran deploy
--hotswaptwice (each on a different version of the code that changed lambda code, theVERSIONenv var, and theSUBvariable and found no regressions. These changes fixed a case for hotswap that before these changes, could not handle theSELECTvariable:{ "Parameters": { "Idx": { "Type": "Number", "Default": "1" }, ...TRUNCATED... "SELECT": { "Fn::Select": [ { "Ref": "Idx" }, [ "zero", "one", "two" ] ] }, ...TRUNCATED...and would fail to evaluate the index, leading to a value of
['zero','one','two'][{ Ref: 'Idx' }](which isundefined), so the variable gets dropped. This was a hidden bug and did not error out. It had the potential to break a deployed application.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license