-
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 importing existing orphaned resources to CloudFormation stacks #9686
Comments
There are ways to use existing resources in CDK apps. See the Resources topic in the Developer Guide. Does that help? |
@jerry-aws No. Like I said in the issue description, I'm not talking about referring to external resources. I'm talking about importing orphaned resources back into a CloudFormation stack so that CloudFormation actually takes ownership of the resource. CloudFormation supports this, so I think AWS CDK could support it too. |
We are tracking this in the RFC repo, see aws/aws-cdk-rfcs#52. Closing this in favor of the RFC issues. |
Is there any workaround to reattach an orphaned s3 to cdk stack ? |
@hugomallet when you create a new stack you can import resources. however you maybe need to add some additional parameters like 'retention' to the resources. (the cloud-formation import is so nice to prompt you why it failed) |
CloudFormation has support for importing existing resources into a stack. You can use the ResourcesToImport parameter to createChangeSet to do it.
Could AWS CDK support importing existing resources? The current implementation that calls createChangeSet does not seem to pass the ResourcesToImport parameter in any situation.
I tried to search for existing issues about this. They are hard to find because many issues talk about importing exported values or importing a reference to a resource in another stack. But here I mean importing orphaned cloud resources.
Use Case
Typical use cases are:
These use cases are important when the orphaned resource contains data, e.g. a DynamoDB table or a S3 bucket that cannot be deleted.
Proposed Solution
I am not sure about all the details that are related using to ResourcesToImport. It probably requires a lot of testing with different AWS resource types to make it work.
In a perfect world AWS CDK would automatically import named resources when it notices that the resource already exists outside the stack. It would ask the user for confirmation if there are any issues, like having to tune the resource policy/permissions/properties to make the import work.
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: