Skip to content

CloudFormation V2 Engine: Support for Pseudo Parameter References #12595

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 9 commits into from
May 19, 2025

Conversation

MEPalma
Copy link
Contributor

@MEPalma MEPalma commented May 7, 2025

Motivation

The introduction of the CloudFormation v2 engine laid the foundation for a redesigned engine capable of accurately determining update requirements between CloudFormation deployments, while also enabling parallel execution during updates. However, the current implementation still lacks support for Pseudo Parameter References

Changes

  • Add support for Pseudo parameters
  • Add base ChangeSet lifecycle test
  • Un-skip v1 test for apigateway
  • Moved the responsibility of change set description to the provider
  • Other minors

@MEPalma MEPalma self-assigned this May 7, 2025
@MEPalma MEPalma added the semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases label May 7, 2025
@localstack-bot
Copy link
Collaborator

Currently, only patch changes are allowed on master. Your PR labels (semver: minor) indicate that it cannot be merged into the master at this time.

@MEPalma MEPalma added this to the Playground milestone May 7, 2025
Copy link

github-actions bot commented May 7, 2025

LocalStack Community integration with Pro

  2 files  ±    0    2 suites  ±0   21m 39s ⏱️ - 1h 19m 54s
491 tests  - 3 960  315 ✅  - 3 752  176 💤  - 208  0 ❌ ±0 
493 runs   - 3 960  315 ✅  - 3 752  178 💤  - 208  0 ❌ ±0 

Results for commit 87bc478. ± Comparison against base commit 5f9ae76.

This pull request removes 3961 and adds 1 tests. Note that renamed tests count towards both.
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]
…
tests.aws.services.cloudformation.v2.test_change_set_ref.TestChangeSetRef ‑ test_supported_pseudo_parameter
This pull request removes 209 skipped tests and adds 1 skipped test. Note that renamed tests count towards both.
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input4-FAILED]
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_deployed_infra_state
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_populate_data
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_user_clicks_are_stored
tests.aws.services.apigateway.test_apigateway_api.TestApiGatewayApiRestApi ‑ test_get_api_case_insensitive
tests.aws.services.apigateway.test_apigateway_api.TestApigatewayIntegration ‑ test_put_integration_request_parameter_bool_type
tests.aws.services.apigateway.test_apigateway_basic.TestAPIGateway ‑ test_api_gateway_authorizer_crud
tests.aws.services.apigateway.test_apigateway_basic.TestAPIGateway ‑ test_api_gateway_http_integration_with_path_request_parameter
tests.aws.services.apigateway.test_apigateway_basic.TestAPIGateway ‑ test_api_gateway_lambda_proxy_integration[/lambda/foo1]
…
tests.aws.services.cloudformation.v2.test_change_set_ref.TestChangeSetRef ‑ test_supported_pseudo_parameter

♻️ This comment has been updated with latest results.

@MEPalma MEPalma changed the base branch from master to MEP-CFN-parity_b0 May 8, 2025 11:26
Base automatically changed from MEP-CFN-parity_b0 to master May 8, 2025 13:04
@MEPalma MEPalma marked this pull request as ready for review May 8, 2025 14:33
@MEPalma MEPalma modified the milestones: Playground, 4.5 May 8, 2025
@MEPalma MEPalma added semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases and removed semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases labels May 8, 2025
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.

A great set of changes and a nice pr thanks!

Comment on lines 253 to 254
# TODO: review required behaviour of before and after, are pseudo parameter values constant during
# change set lifecycles?
Copy link
Contributor

Choose a reason for hiding this comment

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

As we discussed, yes they are

Suggested change
# TODO: review required behaviour of before and after, are pseudo parameter values constant during
# change set lifecycles?

# change set lifecycles?
match pseudo_parameter_name:
case "AWS::Partition":
after = "aws"
Copy link
Contributor

Choose a reason for hiding this comment

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

What about our other partition support like govcloud? Maybe leave a todo. What does the v1 engine do here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, indeed we can use the get_partition utility about the region name as the v1 provider does

@@ -318,6 +318,8 @@ def test_cfn_deploy_apigateway_integration(deploy_cfn_template, snapshot, aws_cl
"$.get-stage.lastUpdatedDate",
"$.get-stage.methodSettings",
"$.get-stage.tags",
"$..endpointConfiguration.ipAddressType",
"$..binaryMediaTypes",
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe rebase onto master, this is now in that branch

Comment on lines 323 to 327
template_1 = {
"Resources": {
"Topic": {"Type": "AWS::SNS::Topic", "Properties": {"TopicName": topic_name}},
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason we create an sns topic in template one and use a completely different resource in template two?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, there is no particular reason other than needing an update with a resource listing a number of supported pseudo parameters. I changed it to only use SNS topics.

{"Key": "AccountId", "Value": {"Ref": "AWS::AccountId"}},
{"Key": "Region", "Value": {"Ref": "AWS::Region"}},
{"Key": "StackName", "Value": {"Ref": "AWS::StackName"}},
{"Key": "StackId", "Value": {"Ref": "AWS::StackId"}},
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't cover urlsuffix here. I realise that by definition it will be different from AWS to LocalStack but at least it would be execute the code path

@@ -285,6 +290,31 @@ def _run(*args):

return ExecuteChangeSetOutput()

def _describe_change_set(
Copy link
Contributor

Choose a reason for hiding this comment

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

Great I'm glad it's in the provider.

StackId=change_set.stack.stack_id,
StackName=change_set.stack.stack_name,
CreationTime=change_set.creation_time,
Parameters=[
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we keep the todo about masking ?

@MEPalma MEPalma merged commit fa0bbcd into master May 19, 2025
32 checks passed
@MEPalma MEPalma deleted the MEP-CFN-pseudo_parameters branch May 19, 2025 11:07
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