-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: support editing CfnResource and Stack dependencies #20418
Labels
@aws-cdk/core
Related to core CDK functionality
effort/medium
Medium work item – several days of effort
feature-request
A feature should be added or improved.
p2
Comments
jusdino
added
feature-request
A feature should be added or improved.
needs-triage
This issue or PR still needs to be triaged.
labels
May 19, 2022
4 tasks
rix0rrr
added
effort/medium
Medium work item – several days of effort
p2
and removed
needs-triage
This issue or PR still needs to be triaged.
labels
May 23, 2022
4 tasks
mergify bot
pushed a commit
that referenced
this issue
Dec 19, 2022
Reopening #20419 from a personal fork to allow maintainer edits. @comcalvi 👋 Add some new methods to allow a minimal interface for viewing and editing resource-to-resource dependencies that mirrors the behavior of CfnResource.addDependsOn(). Related to #20418 - details for justification are there ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Construct Runtime Dependencies: * [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [x] 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*
brennanho
pushed a commit
to brennanho/aws-cdk
that referenced
this issue
Jan 20, 2023
Reopening aws#20419 from a personal fork to allow maintainer edits. @comcalvi 👋 Add some new methods to allow a minimal interface for viewing and editing resource-to-resource dependencies that mirrors the behavior of CfnResource.addDependsOn(). Related to aws#20418 - details for justification are there ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Construct Runtime Dependencies: * [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [x] 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*
Closed by #23383 |
|
brennanho
pushed a commit
to brennanho/aws-cdk
that referenced
this issue
Feb 22, 2023
Reopening aws#20419 from a personal fork to allow maintainer edits. @comcalvi 👋 Add some new methods to allow a minimal interface for viewing and editing resource-to-resource dependencies that mirrors the behavior of CfnResource.addDependsOn(). Related to aws#20418 - details for justification are there ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Construct Runtime Dependencies: * [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [x] 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
@aws-cdk/core
Related to core CDK functionality
effort/medium
Medium work item – several days of effort
feature-request
A feature should be added or improved.
p2
Describe the feature
Currently, a user has the ability to use
CfnResource.addDependsOn()
to neatly add explicit dependencies between resources within or across stack boundaries. The catch is that,Node.tryRemoveChild()
can then render a CFT completely invalid, since it can remove the referenced resource from a template entirely but a lingeringDependsOn
value remains set to a logical id that no longer exists.Node.tryRemoveChild()
is, of course, in the 'escape hatch' api space, so I wouldn't expect it to gracefully search out any existing dependency references and remove them for me. However, since there is no visibility into already-set dependencies or any ability to gracefully remove individual dependencies, once a depended-on resource is removed, it becomes impossible for a user to salvage the template through the public API, short of something extreme like blindly adding DependsOn overrides to every resource they think might have a reference to the removed resource, possibly causing a lot more damage in the process. Adding some new methods that give a user the visibility and edit-ability to dependencies would be very powerful in a situation like this.Use Case
Let's say a user has some code:
But then they use some construct/aspect/whatever that needs to recreate
Bar
for some reason:At this point, the construct that replaced
Bar
has no way of knowing that it has just irrevocably invalidated the template, because it has no way of seeing thatFoo
has aDependsOn
reference toBar
, and the only possible way to rectify the template is to addfoo.addOverride('DependsOn', ...)
, possibly squashing some other dependencies in the process.Proposed Solution
Add some new methods to
CfnResource
that makes it possible to look into the dependency relationships and edit them if they really need to:These new
CfnResource.obtainDependsOn()
andCfnResource.removeDependsOn()
would have to gracefully traverse the resource and assembly dependencies to mirror the behavior ofCfnResource.addDependsOn()
, for an intuitive user experience.Other Information
No response
Acknowledgements
CDK version used
any
Environment details (OS name and version, etc.)
any
The text was updated successfully, but these errors were encountered: