05/27/2020, 3:41 PM
Hi there, I'm having difficulty moving some AWS resources from one stack to another. Might anyone have any tips? We have a Typescript stack that sets up resources, chiefly S3 buckets. We've rewritten some of it in Python, and want to make this part (not the whole thing) into a separate stack - without disrupting the existing buckets or their contents. The Python code creates identical resources to the old Typescript code. When I try to run
Pulumi up
with the new code on a new stack, I get:
Error creating S3 bucket: BucketAlreadyOwnedByYou: Your previous request to create the named bucket succeeded and you already own it
Which makes sense - the bucket does already exist. I don't want to destroy and recreate anything - I just want to have these existing resources be managed by this new code and stack. I'd then like to be able to remove the creation of these resources from the old Typescript code.  Is the answer something to do with
pulumi stack import


05/27/2020, 3:59 PM
Instead of attempting to recreate, add an import to your bucket configuration. Something like new aws.s3.Bucket("name", { ... }, { import "bucketname" }); That will import to the current stack. You can then go back and remove the import. Docs here:


05/28/2020, 7:48 AM
Excellent - thank you. I'll give that approach a shot.