Skip to content

CloudFormation: POC Support for Modeling of Outputs Blocks in the Update Graph, Improved Handling of Intrinsic Function Types #12443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 31, 2025

Conversation

MEPalma
Copy link
Contributor

@MEPalma MEPalma commented Mar 26, 2025

Motivation

The current strategy for modeling CloudFormation templates using the Update Graph does not support changes in Outputs blocks. Additionally, the ChangeSetModel class implements a somewhat tedious approach to visiting and modeling intrinsic function types, due to their natural representation as bindings within dictionaries/objects.
This PR introduces support for modeling changes in Outputs blocks within the Update Graph, along with temporary logic to generate descriptions of those changes. The new functionality is covered by several new unit test cases.
Furthermore, this PR improves the parsing and modeling of intrinsic functions by making more extensive use of the recently introduced TypeDivergence node class.
Several additional issues related to intrinsic parsing and the describe logic are also addressed.

Changes

  • Added support for modeling changes in Outputs blocks within the Update Graph.
  • Introduced temporary logic for describing Outputs changes.
  • Added new unit tests covering Outputs diff scenarios.
  • Refactored intrinsic function parsing using the TypeDivergence node class.
  • Simplified modeling of intrinsic function types in ChangeSetModel.
  • Fixed issues in intrinsic parsing and describe logic.

@MEPalma MEPalma added the semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases label Mar 26, 2025
@MEPalma MEPalma added this to the Playground milestone Mar 26, 2025
@MEPalma MEPalma self-assigned this Mar 26, 2025
Copy link

github-actions bot commented Mar 26, 2025

LocalStack Community integration with Pro

  2 files    2 suites   20m 33s ⏱️
431 tests 311 ✅ 120 💤 0 ❌
433 runs  311 ✅ 122 💤 0 ❌

Results for commit bf29ec7.

♻️ This comment has been updated with latest results.

Copy link
Member

@pinzon pinzon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test assertions are not correct. This is the advantage of using snapshot tests.

}
outputs_unit = self.debug_outputs(t1, t2)
assert not outputs_unit.before_context
assert outputs_unit.after_context == [{"Name": "NewParamName", "Value": "NewParam"}]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct. The value should be the Name of the parameter, which is autogenerated by CloudFormation. See the docs. So it should be param-name.

}
outputs_unit = self.debug_outputs(t1, t2)
assert outputs_unit.before_context == [
{"Name": "FeatureToggleName", "Value": "FeatureToggle"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{"Name": "FeatureToggleName", "Value": "FeatureToggle"}
{"Name": "FeatureToggleName", "Value": "app-feature-toggle"}

@MEPalma
Copy link
Contributor Author

MEPalma commented Mar 31, 2025

In this PR, the outputs are evaluated solely by the describer. Since the POC doesn’t yet include executor logic, we still want to validate that Outputs blocks are being parsed correctly and mapped to the intended resources. Given that, the describer currently reports the entity name as a proxy for this verification.

I’d like to keep this logic within the describer for now and plan to move it to the template processor in that very spike, where it can be overridden appropriately by the executor. Does that sound reasonable to you?

Alternatively, for this PR, the describer would use that to consistently sample the "Name" property from a resource’s properties (as a stand-in for a proper output reference). Then, in the executor spike, we can override this with the actual evaluation logic tied to Ref resolution.

@MEPalma MEPalma requested a review from simonrw March 31, 2025 11:53
Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok fair thanks for the explanation @MEPalma . I am happy there is a path forward, but perhaps can we at least add a comment explaining?

@MEPalma MEPalma merged commit 4600910 into master Mar 31, 2025
31 checks passed
@MEPalma MEPalma deleted the MEP-CFN-POC-outputs branch March 31, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants