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

Terraform does not error if an S3 bucket already exists #6490

Closed
smastrorocco opened this issue Nov 16, 2018 · 5 comments
Closed

Terraform does not error if an S3 bucket already exists #6490

smastrorocco opened this issue Nov 16, 2018 · 5 comments
Labels
bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service.

Comments

@smastrorocco
Copy link

smastrorocco commented Nov 16, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.11.7
terraform-provider-aws v1.45.0

Affected Resource(s)

aws_s3_bucket

Terraform Configuration Files

resource "aws_s3_bucket" "bucket" {
  bucket = "bucket-name-that-already-exists"
  acl    = "private"
}

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.

@bflad bflad added the service/s3 Issues and PRs that pertain to the s3 service. label Nov 16, 2018
@GBrawl
Copy link

GBrawl commented Nov 24, 2018

I submitted a pull request for this issue, if someone could take a look at it that would be great

@matthewduren
Copy link

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

@aeschright aeschright added the needs-triage Waiting for first response or review from a maintainer. label Jun 24, 2019
@ryndaniels ryndaniels added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 5, 2019
@ewbankkit
Copy link
Contributor

ewbankkit commented Nov 29, 2019

@gdavison
Copy link
Contributor

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.

@ghost
Copy link

ghost commented Mar 14, 2021

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!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants