Skip to content

Cloud Formation: [POC] Support for Update Graph Modeling of: Conditions, Intrinsic Functions, and Type Divergences #12421

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 6 commits into from
Mar 24, 2025

Conversation

MEPalma
Copy link
Contributor

@MEPalma MEPalma commented Mar 20, 2025

* Depends on #12405

Motivation

Currently, the POC Update Graph approach to modeling CloudFormation templates does not support CloudFormation Conditions. This gap prevents condition-driven workflows from being accurately tracked or updated within the existing logic. In addition, there is no support for certain intrinsic functions (such as Fn::If, Fn::Not, and Fn::Equals). Furthermore, the modeling layer does not currently handle scenarios where changes in a template result in a new subtype or intrinsic function (for example, switching from one intrinsic function to a different one). This limitation meant that strict type changes to certain template bindings was not supported. Finally, caching mechanisms within the describer visitor are needed. A number of minor issues with this pipeline were also addressed. Unit tests have been added to validate these scenarios.

Changes

  • Added base support for modeling CloudFormation Conditions in the Update Graph building logic
  • Added modeling support for new intrinsic functions: Fn::If, Fn::Not, and Fn::Equals
  • Enabled propagation of condition changes throughout the update graph, including condition resource statements and references in intrinsic functions
  • Introduced the NodeDivergence concept, which models changes in subtype values (e.g., switching from one intrinsic function to another)
  • Implemented caching in the describer visitor to improve performance and clarity in describing template changes
  • Added support for describing change set changes involving conditions and the newly added intrinsic functions
  • Created unit tests covering conditions, new intrinsic functions, and the NodeDivergence mechanism
  • Several other minors

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

LocalStack Community integration with Pro

  2 files  ±    0    2 suites  ±0   21m 6s ⏱️ - 1h 30m 36s
422 tests  - 3 882  310 ✅  - 3 673  112 💤  - 209  0 ❌ ±0 
424 runs   - 3 882  310 ✅  - 3 673  114 💤  - 209  0 ❌ ±0 

Results for commit 5c25903. ± Comparison against base commit 7fdfe01.

This pull request removes 3882 tests.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…

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.

Awesome stuff!


Maybe = Union[T, NothingType]
Nothing = NothingType()


class Scope(str):
Copy link
Contributor

Choose a reason for hiding this comment

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

I love this concept, thank you!

self.resources = resources


class NodeDivergence(ChangeSetNode):
Copy link
Contributor

Choose a reason for hiding this comment

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

note for the future: it will be nice to get some docstrings indicating what these resources represent (possibly with an example from a template)

@MEPalma MEPalma changed the base branch from master to MEP-CFN-POC-scope_and_parameters March 24, 2025 12:06
@MEPalma MEPalma merged commit 3c64a4b into MEP-CFN-POC-scope_and_parameters Mar 24, 2025
35 checks passed
@MEPalma MEPalma deleted the MEP-CFN-POC-conditions branch March 24, 2025 12:48
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.

2 participants