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

resource/aws_s3_bucket: Provider produced inconsistent result after apply #11064

Closed
augustine-urolime opened this issue Nov 29, 2019 · 5 comments
Labels
bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@augustine-urolime
Copy link

2019-11-29T04:48:44.201Z [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: 2019/11/29 04:48:44 [DEBUG] [aws-sdk-go]
2019-11-29T04:48:44.201Z [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: 2019/11/29 04:48:44 [DEBUG] [aws-sdk-go] DEBUG: Validate Response s3/HeadBucket failed, attempt 0/25, error NotFoun
d: Not Found
2019-11-29T04:48:44.201Z [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: status code: 404, request id: 25DD7204967332EA, host id: DscRqp364O9rVUZcxJarUNoIeqcUouW722cAXZ2oF3w287K4ABUEQ
pY2q5SkeW32cpayJFbv8I0=
2019-11-29T04:48:44.201Z [DEBUG] plugin.terraform-provider-aws_v2.19.0_x4: 2019/11/29 04:48:44 [WARN] S3 Bucket (xxxxx) not found, error code (404)
2019/11/29 04:48:44 [DEBUG] module.s3.aws_s3_bucket.xxxxx: apply errored, but we're indicating that via the Error pointer rather than returning it: Provider produced inconsistent result after apply: When applying changes to module.s3.aws_s3_bucket.im-etickets-qa, provider "aws" produced an unexpected new value for was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.
2019/11/29 04:48:44 [TRACE] module.s3: eval: *terraform.EvalMaybeTainted
2019/11/29 04:48:44 [TRACE] EvalMaybeTainted: module.s3.aws_s3_bucket.xxx encountered an error during creation, so it is now marked as tainted
2019/11/29 04:48:44 [ERROR] module.s3: eval: *terraform.EvalApplyPost, err: Provider produced inconsistent result after apply: When applying changes to module.s3.aws_s3_bucket.xxxx, provider "aws" produced an unexpected new value for was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.
2019/11/29 04:48:44 [ERROR] module.s3: eval: *terraform.EvalSequence, err: Provider produced inconsistent result after apply: When applying changes to module.s3.aws_s3_bucket.xxxxx, provider "aws" produced an unexpected new value for was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 29, 2019
@ewbankkit
Copy link
Contributor

@bflad bflad added bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 2, 2019
@bflad bflad changed the title Issue with s3 bucket creation resource/aws_s3_bucket: Provider produced inconsistent result after apply Dec 2, 2019
@bflad
Copy link
Contributor

bflad commented Dec 2, 2019

While the code fix will be similar in nature to the fix for #9725, we'll track this separately as the different resource will require a change in a different part of the codebase. We currently retry automatically on resource creation for API error codes, however the HeadBucket (and HeadObject in the other issue) API calls need to be retried on the 404 HTTP status code for new resources.

@augustine-urolime
Copy link
Author

Actually the code only does creation of 100's of buckets only without any other further dependencies.

@bflad
Copy link
Contributor

bflad commented Mar 30, 2021

This issue should have been resolved awhile ago with version 2.48.0 of the Terraform AWS Provider. There are some minor adjustments we can make to the read logic that would make this particular error impossible to occur as-is, but the read-after-create retry logic introduced in that earlier version should cover the issue enough to prevent it.

If you are still having trouble with the aws_s3_bucket resource and this error on more recent versions of the Terraform AWS Provider, please open a new bug report filling in the issue template and we can take a fresh look. 👍

@bflad bflad closed this as completed Mar 30, 2021
bflad added a commit that referenced this issue Mar 30, 2021
…from state

Reference: #11064
Reference: #11894
Reference: #16796

The read-after-create retry logic was previously introduced, however to fully satisfy upcoming linting, this ensures  `d.IsNewResource()` is always checked before potential state removal.

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSS3Bucket_acceleration (162.34s)
--- PASS: TestAccAWSS3Bucket_AclToGrant (120.99s)
--- PASS: TestAccAWSS3Bucket_basic (53.62s)
--- PASS: TestAccAWSS3Bucket_Bucket_EmptyString (68.41s)
--- PASS: TestAccAWSS3Bucket_Cors_Delete (43.05s)
--- PASS: TestAccAWSS3Bucket_Cors_EmptyOrigin (32.87s)
--- PASS: TestAccAWSS3Bucket_Cors_Update (144.98s)
--- PASS: TestAccAWSS3Bucket_disableDefaultEncryption_whenDefaultEncryptionIsEnabled (120.85s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenAES256IsUsed (53.62s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenTypical (63.60s)
--- PASS: TestAccAWSS3Bucket_forceDestroy (43.05s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithEmptyPrefixes (44.07s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithObjectLockEnabled (52.76s)
--- PASS: TestAccAWSS3Bucket_generatedName (44.56s)
--- PASS: TestAccAWSS3Bucket_GrantToAcl (131.72s)
--- PASS: TestAccAWSS3Bucket_ignoreTags (48.65s)
--- PASS: TestAccAWSS3Bucket_LifecycleBasic (185.77s)
--- PASS: TestAccAWSS3Bucket_LifecycleExpireMarkerOnly (133.55s)
--- PASS: TestAccAWSS3Bucket_LifecycleRule_AbortIncompleteMultipartUploadDays_NoExpiration (91.92s)
--- PASS: TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock (68.06s)
--- PASS: TestAccAWSS3Bucket_Logging (80.94s)
--- PASS: TestAccAWSS3Bucket_namePrefix (86.62s)
--- PASS: TestAccAWSS3Bucket_objectLock (120.99s)
--- PASS: TestAccAWSS3Bucket_Policy (204.40s)
--- PASS: TestAccAWSS3Bucket_Replication (170.13s)
--- PASS: TestAccAWSS3Bucket_Replication_MultipleDestinations_EmptyFilter (96.34s)
--- PASS: TestAccAWSS3Bucket_Replication_MultipleDestinations_NonEmptyFilter (90.92s)
--- PASS: TestAccAWSS3Bucket_Replication_MultipleDestinations_TwoDestination (81.48s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (127.52s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AddAccessControlTranslation (152.48s)
--- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (19.04s)
--- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (127.40s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (67.60s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (68.88s)
--- PASS: TestAccAWSS3Bucket_RequestPayer (55.86s)
--- PASS: TestAccAWSS3Bucket_SameRegionReplicationSchemaV2 (86.01s)
--- PASS: TestAccAWSS3Bucket_shouldFailNotFound (27.15s)
--- PASS: TestAccAWSS3Bucket_tagsWithNoSystemTags (184.89s)
--- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (249.63s)
--- PASS: TestAccAWSS3Bucket_UpdateAcl (165.05s)
--- PASS: TestAccAWSS3Bucket_UpdateGrant (202.57s)
--- PASS: TestAccAWSS3Bucket_Versioning (185.93s)
--- PASS: TestAccAWSS3Bucket_Website_Simple (194.76s)
--- PASS: TestAccAWSS3Bucket_WebsiteRedirect (205.52s)
--- PASS: TestAccAWSS3Bucket_WebsiteRoutingRules (145.48s)
```

Output from acceptance testing in AWS GovCloud (US):

```
--- PASS: TestAccAWSS3Bucket_AclToGrant (160.61s)
--- PASS: TestAccAWSS3Bucket_basic (102.32s)
--- PASS: TestAccAWSS3Bucket_Bucket_EmptyString (47.12s)
--- PASS: TestAccAWSS3Bucket_Cors_Delete (73.58s)
--- PASS: TestAccAWSS3Bucket_Cors_EmptyOrigin (93.14s)
--- PASS: TestAccAWSS3Bucket_Cors_Update (124.65s)
--- PASS: TestAccAWSS3Bucket_disableDefaultEncryption_whenDefaultEncryptionIsEnabled (177.31s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenAES256IsUsed (102.41s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenTypical (104.21s)
--- PASS: TestAccAWSS3Bucket_forceDestroy (30.55s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithEmptyPrefixes (77.52s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithObjectLockEnabled (82.55s)
--- PASS: TestAccAWSS3Bucket_generatedName (56.14s)
--- PASS: TestAccAWSS3Bucket_GrantToAcl (148.69s)
--- PASS: TestAccAWSS3Bucket_ignoreTags (77.72s)
--- PASS: TestAccAWSS3Bucket_LifecycleBasic (106.81s)
--- PASS: TestAccAWSS3Bucket_LifecycleExpireMarkerOnly (57.95s)
--- PASS: TestAccAWSS3Bucket_LifecycleRule_AbortIncompleteMultipartUploadDays_NoExpiration (94.53s)
--- PASS: TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock (93.10s)
--- PASS: TestAccAWSS3Bucket_Logging (96.14s)
--- PASS: TestAccAWSS3Bucket_namePrefix (86.46s)
--- PASS: TestAccAWSS3Bucket_objectLock (177.29s)
--- PASS: TestAccAWSS3Bucket_Policy (139.09s)
--- PASS: TestAccAWSS3Bucket_Replication (257.20s)
--- PASS: TestAccAWSS3Bucket_Replication_MultipleDestinations_TwoDestination (83.12s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (141.90s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AddAccessControlTranslation (199.30s)
--- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (54.11s)
--- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (127.71s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (118.37s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (40.94s)
--- PASS: TestAccAWSS3Bucket_RequestPayer (60.94s)
--- PASS: TestAccAWSS3Bucket_SameRegionReplicationSchemaV2 (117.02s)
--- PASS: TestAccAWSS3Bucket_shouldFailNotFound (55.59s)
--- PASS: TestAccAWSS3Bucket_tagsWithNoSystemTags (132.60s)
--- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (170.72s)
--- PASS: TestAccAWSS3Bucket_UpdateAcl (179.16s)
--- PASS: TestAccAWSS3Bucket_UpdateGrant (168.05s)
--- PASS: TestAccAWSS3Bucket_Versioning (152.26s)
--- PASS: TestAccAWSS3Bucket_Website_Simple (190.02s)
--- PASS: TestAccAWSS3Bucket_WebsiteRedirect (191.16s)
--- PASS: TestAccAWSS3Bucket_WebsiteRoutingRules (60.83s)
--- SKIP: TestAccAWSS3Bucket_acceleration (0.00s)
--- SKIP: TestAccAWSS3Bucket_Replication_MultipleDestinations_EmptyFilter (46.15s)
--- SKIP: TestAccAWSS3Bucket_Replication_MultipleDestinations_NonEmptyFilter (46.08s)
```
bflad added a commit that referenced this issue Mar 31, 2021
…from state (#18488)

Reference: #11064
Reference: #11894
Reference: #16796

The read-after-create retry logic was previously introduced, however to fully satisfy upcoming linting, this ensures  `d.IsNewResource()` is always checked before potential state removal.

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSS3Bucket_acceleration (162.34s)
--- PASS: TestAccAWSS3Bucket_AclToGrant (120.99s)
--- PASS: TestAccAWSS3Bucket_basic (53.62s)
--- PASS: TestAccAWSS3Bucket_Bucket_EmptyString (68.41s)
--- PASS: TestAccAWSS3Bucket_Cors_Delete (43.05s)
--- PASS: TestAccAWSS3Bucket_Cors_EmptyOrigin (32.87s)
--- PASS: TestAccAWSS3Bucket_Cors_Update (144.98s)
--- PASS: TestAccAWSS3Bucket_disableDefaultEncryption_whenDefaultEncryptionIsEnabled (120.85s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenAES256IsUsed (53.62s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenTypical (63.60s)
--- PASS: TestAccAWSS3Bucket_forceDestroy (43.05s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithEmptyPrefixes (44.07s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithObjectLockEnabled (52.76s)
--- PASS: TestAccAWSS3Bucket_generatedName (44.56s)
--- PASS: TestAccAWSS3Bucket_GrantToAcl (131.72s)
--- PASS: TestAccAWSS3Bucket_ignoreTags (48.65s)
--- PASS: TestAccAWSS3Bucket_LifecycleBasic (185.77s)
--- PASS: TestAccAWSS3Bucket_LifecycleExpireMarkerOnly (133.55s)
--- PASS: TestAccAWSS3Bucket_LifecycleRule_AbortIncompleteMultipartUploadDays_NoExpiration (91.92s)
--- PASS: TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock (68.06s)
--- PASS: TestAccAWSS3Bucket_Logging (80.94s)
--- PASS: TestAccAWSS3Bucket_namePrefix (86.62s)
--- PASS: TestAccAWSS3Bucket_objectLock (120.99s)
--- PASS: TestAccAWSS3Bucket_Policy (204.40s)
--- PASS: TestAccAWSS3Bucket_Replication (170.13s)
--- PASS: TestAccAWSS3Bucket_Replication_MultipleDestinations_EmptyFilter (96.34s)
--- PASS: TestAccAWSS3Bucket_Replication_MultipleDestinations_NonEmptyFilter (90.92s)
--- PASS: TestAccAWSS3Bucket_Replication_MultipleDestinations_TwoDestination (81.48s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (127.52s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AddAccessControlTranslation (152.48s)
--- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (19.04s)
--- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (127.40s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (67.60s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (68.88s)
--- PASS: TestAccAWSS3Bucket_RequestPayer (55.86s)
--- PASS: TestAccAWSS3Bucket_SameRegionReplicationSchemaV2 (86.01s)
--- PASS: TestAccAWSS3Bucket_shouldFailNotFound (27.15s)
--- PASS: TestAccAWSS3Bucket_tagsWithNoSystemTags (184.89s)
--- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (249.63s)
--- PASS: TestAccAWSS3Bucket_UpdateAcl (165.05s)
--- PASS: TestAccAWSS3Bucket_UpdateGrant (202.57s)
--- PASS: TestAccAWSS3Bucket_Versioning (185.93s)
--- PASS: TestAccAWSS3Bucket_Website_Simple (194.76s)
--- PASS: TestAccAWSS3Bucket_WebsiteRedirect (205.52s)
--- PASS: TestAccAWSS3Bucket_WebsiteRoutingRules (145.48s)
```

Output from acceptance testing in AWS GovCloud (US):

```
--- PASS: TestAccAWSS3Bucket_AclToGrant (160.61s)
--- PASS: TestAccAWSS3Bucket_basic (102.32s)
--- PASS: TestAccAWSS3Bucket_Bucket_EmptyString (47.12s)
--- PASS: TestAccAWSS3Bucket_Cors_Delete (73.58s)
--- PASS: TestAccAWSS3Bucket_Cors_EmptyOrigin (93.14s)
--- PASS: TestAccAWSS3Bucket_Cors_Update (124.65s)
--- PASS: TestAccAWSS3Bucket_disableDefaultEncryption_whenDefaultEncryptionIsEnabled (177.31s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenAES256IsUsed (102.41s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenTypical (104.21s)
--- PASS: TestAccAWSS3Bucket_forceDestroy (30.55s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithEmptyPrefixes (77.52s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithObjectLockEnabled (82.55s)
--- PASS: TestAccAWSS3Bucket_generatedName (56.14s)
--- PASS: TestAccAWSS3Bucket_GrantToAcl (148.69s)
--- PASS: TestAccAWSS3Bucket_ignoreTags (77.72s)
--- PASS: TestAccAWSS3Bucket_LifecycleBasic (106.81s)
--- PASS: TestAccAWSS3Bucket_LifecycleExpireMarkerOnly (57.95s)
--- PASS: TestAccAWSS3Bucket_LifecycleRule_AbortIncompleteMultipartUploadDays_NoExpiration (94.53s)
--- PASS: TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock (93.10s)
--- PASS: TestAccAWSS3Bucket_Logging (96.14s)
--- PASS: TestAccAWSS3Bucket_namePrefix (86.46s)
--- PASS: TestAccAWSS3Bucket_objectLock (177.29s)
--- PASS: TestAccAWSS3Bucket_Policy (139.09s)
--- PASS: TestAccAWSS3Bucket_Replication (257.20s)
--- PASS: TestAccAWSS3Bucket_Replication_MultipleDestinations_TwoDestination (83.12s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (141.90s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AddAccessControlTranslation (199.30s)
--- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (54.11s)
--- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (127.71s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (118.37s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (40.94s)
--- PASS: TestAccAWSS3Bucket_RequestPayer (60.94s)
--- PASS: TestAccAWSS3Bucket_SameRegionReplicationSchemaV2 (117.02s)
--- PASS: TestAccAWSS3Bucket_shouldFailNotFound (55.59s)
--- PASS: TestAccAWSS3Bucket_tagsWithNoSystemTags (132.60s)
--- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (170.72s)
--- PASS: TestAccAWSS3Bucket_UpdateAcl (179.16s)
--- PASS: TestAccAWSS3Bucket_UpdateGrant (168.05s)
--- PASS: TestAccAWSS3Bucket_Versioning (152.26s)
--- PASS: TestAccAWSS3Bucket_Website_Simple (190.02s)
--- PASS: TestAccAWSS3Bucket_WebsiteRedirect (191.16s)
--- PASS: TestAccAWSS3Bucket_WebsiteRoutingRules (60.83s)
--- SKIP: TestAccAWSS3Bucket_acceleration (0.00s)
--- SKIP: TestAccAWSS3Bucket_Replication_MultipleDestinations_EmptyFilter (46.15s)
--- SKIP: TestAccAWSS3Bucket_Replication_MultipleDestinations_NonEmptyFilter (46.08s)
```
@ghost
Copy link

ghost commented Apr 30, 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 Apr 30, 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

No branches or pull requests

3 participants