I created and deployed a S3 resource (bucket) using cloudformation. After that i deployed a version without that resource. Then i deployed a version with the resource.
Since the bucket exists, it gives me an error that it cannot deploy. This has happened to me before, in past times I deleted the resource and deployed again. I'm looking for a way to use the resource for future deployments. It is the exact same resource, this is the yaml :
Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "myBucketName"
Is there anything I can add to the resource, a policy, a unique ID, anything so that i could use the existing resource?
Thanks!
CodePudding user response:
To "use the existing resource" in a CFN, you have to import it. Also its a bad practice to keep modify resources created by CFN outside of CFN. This leads to drift and number of issues, one of which you are experiencing.