-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
aws_s3_bucket create fails with NoSuchBucket error listing resource tags #13008
Comments
Same here.
|
References: * hashicorp#13008 The AWS S3 service has eventual consistency considerations. If a GetBucketTagging call is made to obtain tags just after an S3 bucket is first created, AWS may return an HTTP 404 (NotFound) error with a NoSuchBucket error code. A fix was added for this in hashicorp#12418. It appears that the NoSuchBucket errors are not retried with this fix, however. This commit adds some extra logic which ensures that the code from the awserr.Error instance is evaluated for retry. Output for acceptance testing: ``` > make testacc TEST=./aws TESTARGS='-run=TestAccAWSS3Bucket_' ... --- PASS: TestAccAWSS3Bucket_shouldFailNotFound (22.93s) --- PASS: TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock (38.71s) --- PASS: TestAccAWSS3Bucket_forceDestroyWithEmptyPrefixes (40.46s) --- PASS: TestAccAWSS3Bucket_forceDestroy (40.47s) --- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenAES256IsUsed (45.72s) --- PASS: TestAccAWSS3Bucket_basic (45.79s) --- PASS: TestAccAWSS3Bucket_forceDestroyWithObjectLockEnabled (47.59s) --- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (51.85s) --- PASS: TestAccAWSS3Bucket_LifecycleBasic (95.95s) --- PASS: TestAccAWSS3Bucket_LifecycleExpireMarkerOnly (69.16s) --- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenTypical (71.63s) --- PASS: TestAccAWSS3Bucket_objectLock (74.52s) --- PASS: TestAccAWSS3Bucket_disableDefaultEncryption_whenDefaultEncryptionIsEnabled (75.75s) --- PASS: TestAccAWSS3Bucket_region (42.47s) --- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (96.80s) --- PASS: TestAccAWSS3Bucket_WebsiteRoutingRules (77.87s) --- PASS: TestAccAWSS3Bucket_Versioning (106.51s) --- PASS: TestAccAWSS3Bucket_UpdateGrant (110.50s) --- PASS: TestAccAWSS3Bucket_GrantToAcl (71.89s) --- PASS: TestAccAWSS3Bucket_AclToGrant (72.06s) --- PASS: TestAccAWSS3Bucket_generatedName (47.42s) --- PASS: TestAccAWSS3Bucket_UpdateAcl (74.86s) --- PASS: TestAccAWSS3Bucket_namePrefix (44.58s) --- PASS: TestAccAWSS3Bucket_RequestPayer (75.62s) --- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (97.00s) --- PASS: TestAccAWSS3Bucket_Cors_EmptyOrigin (47.36s) --- PASS: TestAccAWSS3Bucket_WebsiteRedirect (109.43s) --- PASS: TestAccAWSS3Bucket_Website_Simple (109.41s) --- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AddAccessControlTranslation (152.76s) --- PASS: TestAccAWSS3Bucket_acceleration (81.59s) --- PASS: TestAccAWSS3Bucket_Cors_Delete (36.58s) --- PASS: TestAccAWSS3Bucket_Bucket_EmptyString (44.94s) --- PASS: TestAccAWSS3Bucket_Logging (66.26s) --- PASS: TestAccAWSS3Bucket_Policy (104.79s) --- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (176.75s) --- PASS: TestAccAWSS3Bucket_Cors_Update (71.71s) --- PASS: TestAccAWSS3Bucket_tagsWithNoSystemTags (135.94s) --- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (168.39s) --- PASS: TestAccAWSS3Bucket_Replication (270.65s) --- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (273.25s) ```
This functionality has been released in v3.57.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! |
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. |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Here are some snippets of the debug log around where the error occurs. The problem appears to occur when AWS returns a 404 Not Found error in response to the
GetBucketTagging
call for a new S3 bucket.The debug log shows that the S3 bucket itself appears to be created properly:
When the error occurs, the subsequent
GetBucketTagging
request/response looks like this:Panic Output
Expected Behavior
The S3 bucket is created properly and the
terraform apply
should succeed.Actual Behavior
Most of the time, the expected behavior occurs. Intermittently, though, the S3 bucket is created successfully in AWS but the
terraform apply
fails when trying to retrieve tags for the bucket:If a second
terraform apply
is attempted after the error occurs, theterraform apply
succeeds.Given that the problem is intermittent and a later apply succeeds, it seems like the error may be due to an eventual consistency issue.
Steps to Reproduce
terraform apply
Important Factoids
References
This appears to be the same as the issue referenced in #12418, but this problem is still reproducible on the latest provider code (v2.59.0), which includes this fix.
The text was updated successfully, but these errors were encountered: