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

[Workspace block aws_s3_bucket_versioning] #23510

Closed
lucasp0r opened this issue Mar 4, 2022 · 11 comments · Fixed by #24399
Closed

[Workspace block aws_s3_bucket_versioning] #23510

lucasp0r opened this issue Mar 4, 2022 · 11 comments · Fixed by #24399
Labels
bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@lucasp0r
Copy link

lucasp0r commented Mar 4, 2022

Hello Everyone,

After a few hours to understand how I got an error in this resource, I understood what happens.

If I use my workspace and I got lock-in that workspace, if unblock that, and I try to apply or destroy these resources, I got an error.

So I tried to simulate this in others services like EKS, ECS, ALB, ROUTE53 etc.. and more of that. Same process, lock-in in my workspace, unblock that, and apply/destroy, but works properly in that resources. So I just got a problem with aws_s3_bucket_versioning

Is a kind of strange like this is a new resource in provider 4.0.0 +, maybe a bug? Someone can help?

Code

resource "aws_s3_bucket" "bucket" {
  bucket = var.name_bucket
}

resource "aws_s3_bucket_acl" "bucket" {
  bucket = aws_s3_bucket.bucket.id
  acl    = "private"
}

resource "aws_s3_bucket_versioning" "versioning_bucket" {
  bucket = aws_s3_bucket.bucket.id
  versioning_configuration {
    status = "Enabled"
  }
}

Error


│ Error: error waiting for S3 Bucket Versioning status for bucket (name_bucket): couldn't find resource (4 retries)
│ 
│   with module.s3.aws_s3_bucket_versioning.versioning_bucket,
│   on modules/s3/main.tf line 10, in resource "aws_s3_bucket_versioning" "versioning_bucket":
│   10: resource "aws_s3_bucket_versioning" "versioning_bucket" {

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 other comments that do not add relevant new information or questions, 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 CLI and Terraform AWS Provider Version

Latest version for both

Affected Resource(s)

  • aws_s3_bucket_versioning

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Debug Output

Panic Output

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply/destroy

References

  • #0000
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/s3 Issues and PRs that pertain to the s3 service. labels Mar 4, 2022
@justinretzolk
Copy link
Member

Hey @lucasp0r 👋 Thank you for taking the time to raise this! So that we have all of the necessary information in order to look into this, can you update the issue description to include the rest of the information requested in the template (particularly debug logs, redacted as necessary)?

I also attempted to reproduce this with the Terraform configuration supplied and was not able to reproduce the error; can you expand a bit more on the steps to reproduce?

@justinretzolk justinretzolk added waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. labels Mar 4, 2022
@toxinu
Copy link

toxinu commented Mar 8, 2022

@justinretzolk I also got this error, not while creating the resource but then retrieving provider information during a second terraform plan run while refreshing the state.

It looks like this is only happening while not using the default workspace, but I have no idea if this is related.

Sorry, it is kinda difficult to give you debug commands because everything is happening in CI pipelines. I will try to give you more details soon.

@github-actions github-actions bot removed the waiting-response Maintainers are waiting on response from community or contributor. label Mar 8, 2022
@lucasp0r
Copy link
Author

lucasp0r commented Mar 8, 2022

Hey @lucasp0r wave Thank you for taking the time to raise this! So that we have all of the necessary information in order to look into this, can you update the issue description to include the rest of the information requested in the template (particularly debug logs, redacted as necessary)?

I also attempted to reproduce this with the Terraform configuration supplied and was not able to reproduce the error; can you expand a bit more on the steps to reproduce?

Actually, I don't have more logs, the bug is that. Resume: if i got any problem with my workspace like lock or something, after that if i try to apply or destroy this resource i got error.

@kevinkupski
Copy link
Contributor

I received the same error. I also use workspaces and the error occurred after the S3 bucket was deleted outside of Terraform. During resource refresh I also got Error: error waiting for S3 Bucket Versioning status for bucket (my-bucket): couldn't find resource (4 retries). I saw some similar errors with other resources in the past, when the refresh did not handle the absence of the resource correctly.

@justinretzolk justinretzolk added the bug Addresses a defect in current functionality. label Mar 18, 2022
@dykevinli924
Copy link

I was having the same error. This is probably because you deleted your resource manually. In this case, you probably deleted the S3 bucket that was created by Terraform. Try manually add an S3 bucket with the same bucket name and redo it. See how it goes.

@lerrigatto
Copy link

Hi! I am having the same issue when applying from scratch. If I run an apply targeting only the bucket and then re-apply everything, it works.

@erikpaasonen
Copy link
Contributor

Pretty sure this behavior is due to the fact that the code behind aws_s3_bucket_versioning currently has a short-circuit error check whose effect is to bypass the error handling code. The unreachable code would gracefully remove this resource from the tfstate file if the bucket were to be deleted outside of Terraform. most other aws_s3_bucket secondary resource objects have this check, just not this one. (Also found it missing from the aws_s3_bucket_policy resource as well, so included adding it there too.) opened #24399 with a proposed fix.

@github-actions github-actions bot added this to the v4.12.0 milestone Apr 27, 2022
@kinglet-heb
Copy link

Manually adding the s3 bucket with versioning enable works, yes. I see this is closed now but I'm still getting the same error. Is there an open discussion for aws_s3_bucket_versioning status?

@anGie44
Copy link
Contributor

anGie44 commented Apr 28, 2022

HI @ingletkimi , the fix hasn't been released just yet, will likely be available later today with v4.12.0 of the AWS provider. Are you getting the error with a local build of the provider?

Is there an open discussion for aws_s3_bucket_versioning status?

Not that I am aware of. There is this issue #23809 that perhaps is related but if you have a separate feature request or bug you'd like add, feel free to create a new issue in the repo.

@github-actions
Copy link

This functionality has been released in v4.12.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Jun 6, 2022

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 6, 2022
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.

9 participants