Skip to content
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

fix(core): CfnMapping values cannot be used in other stacks #20616

Merged
merged 14 commits into from
Jun 15, 2022

Conversation

comcalvi
Copy link
Contributor

@comcalvi comcalvi commented Jun 3, 2022

Creating a CfnMapping in one stack and then using findInMap() in another stack will result in an error at deploy time because the findInMap() will turn into a Fn::FindInMap that searches for a mapping that does not exist. This change copies the mapping to any stack that references it, even if it is not defined.

Closes #18920.


All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@comcalvi comcalvi requested a review from rix0rrr June 3, 2022 21:58
@gitpod-io
Copy link

gitpod-io bot commented Jun 3, 2022

@aws-cdk-automation aws-cdk-automation requested a review from a team June 3, 2022 21:58
@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p1 labels Jun 3, 2022
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 3, 2022
@comcalvi
Copy link
Contributor Author

comcalvi commented Jun 3, 2022

Certain characters (like / or --) are not being correctly transformed, causing the ID check to incorrectly think an ID is missing.

Fixed by using tryFindChild()

packages/@aws-cdk/core/lib/cfn-mapping.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/core/lib/cfn-mapping.ts Outdated Show resolved Hide resolved
…rs) groups=1896053708(ANT\Domain Users),12(everyone),61(localaccounts),80(admin),702(com.apple.sharepoint.group.2),33(_appstore),98(_lpadmin),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae),701(com.apple.sharepoint.group.1)
@comcalvi comcalvi requested a review from rix0rrr June 14, 2022 22:32
Copy link
Contributor

@rix0rrr rix0rrr left a comment

Choose a reason for hiding this comment

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

Please make sure that your PR title confirms to the conventional commit standard (fix, feat, chore) and that it is written in a style that will reflect correctly in the change log (See Contributing Guide, Pull Requests)

@rix0rrr rix0rrr changed the title fix(core): Automatically create CfnMapping if its value is referenced in another stack fix(core): CfnMapping values cannot be used in other stacks Jun 14, 2022
@mergify
Copy link
Contributor

mergify bot commented Jun 14, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 56ef487
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit f5c2284 into aws:main Jun 15, 2022
@mergify
Copy link
Contributor

mergify bot commented Jun 15, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

daschaa pushed a commit to daschaa/aws-cdk that referenced this pull request Jul 9, 2022
Creating a `CfnMapping` in one stack and then using `findInMap()` in another stack will result in an error at deploy time because the `findInMap()` will turn into a `Fn::FindInMap` that searches for a mapping that does not exist. This change copies the mapping to any stack that references it, even if it is not defined.

Closes aws#18920.

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(core): CfnMapping in one stack, use value in another
3 participants