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

[core] Resources in Stages in Stacks are synthesized into the parent template #9792

Closed
rix0rrr opened this issue Aug 18, 2020 · 0 comments · Fixed by #10156
Closed

[core] Resources in Stages in Stacks are synthesized into the parent template #9792

rix0rrr opened this issue Aug 18, 2020 · 0 comments · Fixed by #10156
Assignees
Labels
@aws-cdk/core Related to core CDK functionality @aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 18, 2020

Discovered in #9669


This is 🐛 Bug Report

@rix0rrr rix0rrr added bug This issue is a bug. p1 @aws-cdk/core Related to core CDK functionality needs-triage This issue or PR still needs to be triaged. @aws-cdk/pipelines CDK Pipelines library labels Aug 18, 2020
@rix0rrr rix0rrr added this to the [CDK Pipelines] Soon milestone Aug 18, 2020
@rix0rrr rix0rrr self-assigned this Aug 18, 2020
@rix0rrr rix0rrr added the effort/small Small work item – less than a day of effort label Aug 18, 2020
@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Aug 18, 2020
rix0rrr added a commit that referenced this issue Sep 3, 2020
In current recommended CDK Pipelines usage, the construct tree looks
like this:

```
App -> Stack1 -> Stage -> Stack2 -> Resource
```

It's an easy mistake to forget `Stack2` (or make it a generic
`Construct` instead), in which case the hierachy looks like the one
below and `Stack1` will render Resource in its CloudFormation template:

```
App -> Stack1 -> Stage -> Construct -> Resource
```

This case should not have been allowed in the first place: `Stage`s
define a new assembly scope and so `Stack1` does not exist from the
point of view of `Resource`.

Change `Stack.of()` to fail to find `Stack1` in this case, so
that it becomes illegal to define `Resource` in this position.

Fixes #9792, relates to #9669.
@mergify mergify bot closed this as completed in #10156 Sep 8, 2020
mergify bot pushed a commit that referenced this issue Sep 8, 2020
…0156)

In current recommended CDK Pipelines usage, the construct tree looks
like this:

```
App -> Stack1 -> Stage -> Stack2 -> Resource
```

It's an easy mistake to forget `Stack2` (or make it a generic
`Construct` instead), in which case the hierachy looks like the one
below and `Stack1` will render Resource in its CloudFormation template:

```
App -> Stack1 -> Stage -> Construct -> Resource
```

This case should not have been allowed in the first place: `Stage`s
define a new assembly scope and so `Stack1` does not exist from the
point of view of `Resource`.

Change `Stack.of()` to fail to find `Stack1` in this case, so
that it becomes illegal to define `Resource` in this position.

Fixes #9792, relates to #9669.


----

*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
@aws-cdk/core Related to core CDK functionality @aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants