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

Is there a way to reattach resource after CloudFormation stack deleted? #8611

Closed
2 tasks
yanshengjia opened this issue Jun 17, 2020 · 4 comments
Closed
2 tasks
Assignees
Labels
@aws-cdk/aws-sqs Related to Amazon Simple Queue Service feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. package/tools Related to AWS CDK Tools or CLI

Comments

@yanshengjia
Copy link

yanshengjia commented Jun 17, 2020

I used CDK to deploy a SQS (with deletion policy RETAIN) and manully deleted CF stack in console, when I cdk deploy again, is there a way to reattach CDK stack to previous existing SQS?
I guess deletion policy Snapshot is a go. But AWS::SQS::Queue does not support deletion policy Snapshot.

Use Case

If someone accidently deletes CF stack and I cdk deploy again, I want my cdk stack can reattach to existing SQS service.

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@yanshengjia yanshengjia added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jun 17, 2020
@SomayaB SomayaB added @aws-cdk/aws-sqs Related to Amazon Simple Queue Service package/tools Related to AWS CDK Tools or CLI labels Jun 18, 2020
@shivlaks
Copy link
Contributor

@yanshengjia the ability to import a resource into a stack is not available through the CDK yet.
Would you mind adding your use case / details to aws/aws-cdk-rfcs#52 if it's not captured there already.

I'm resolving this as the RFC is the starting point to support this feature.
Feel free to reopen if I've interpreted your use case incorrectly!

@yanshengjia
Copy link
Author

Sure.

For now, the workaround is mapping ARN in cdk.CfnMapping?

@shivlaks
Copy link
Contributor

@yanshengjia you can reference your SQS Queue through the fromQueueArn and fromQueueAttributes APIs

These will import the resource that is no longer governed by the stack into your app so that it can be referenced.
Note that this is not the same as importing the resource into the stack. You will not be able to modify any properties of the queue, but you can reference it and use it in your application.

Hope that helps!

@yanshengjia
Copy link
Author

@shivlaks Very helpful! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-sqs Related to Amazon Simple Queue Service feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

3 participants