-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Terraform does not error if an S3 bucket already exists #6490
Comments
I submitted a pull request for this issue, if someone could take a look at it that would be great |
It is nuts that this is still open! We just encountered a problem with this where someone created a bucket in a new project but messed up the name, and terraform said the bucket created successfully and added it to its state. When we went back and fixed the name, terraform tried to delete the bucket (it was in two different tfstates at that point). +1'ed |
Hi @smastrorocco. Now that S3 is strongly consistent, we won't run into race conditions like this. I'm going to close this issue. If you continue to encounter this problem, please open a new issue. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Terraform Version
Affected Resource(s)
aws_s3_bucket
Terraform Configuration Files
Expected Behavior
Error: S3 bucket with name "bucket-name-that-already-exists" already exists
Actual Behavior
Upon plan/apply, Terraform acts as if it created the resource and begins managing it in state, leaving the bucket under two different Terraform configurations management/state files.
Steps to Reproduce
Define two resources with the same bucket name. Can be in the same Terraform configuration or different ones.
Important Factoids
We keep all SDLC environments in separate Terraform workspaces. When develops work locally, they get a workspace with the name of their git branch. This was discovered by a developer copy/pasting the name of an existing bucket while testing into a resource within their branch that already existed.
After that we were able to confirm if we simply copy/paste the resource N times and change the resource name (but not the bucket name), they all create successfully.
The text was updated successfully, but these errors were encountered: