-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(core): CfnMapping in one stack, use value in another #18920
Comments
Example: const stack1 = new Stack(app, 'Stack1');
const mapping = new CfnMapping(stack1, 'Mapping', {
mapping: {
'boo': {
'bah': 'hello'
},
},
});
const stack2 = new Stack(app, 'Stack2');
new CfnOutput(stack2, 'Output', {
value: mapping.findInMap('boo', 'bah'),
}); |
Current result: generates a Simplest desired result: generate the same mapping in Stack2. |
Solution: turn the result value of |
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: * [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*
|
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*
What is the problem?
CfnMapping in one stack, use value in another.
Will lead to "unknown mapping" error in 2nd stack.
The text was updated successfully, but these errors were encountered: