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

aws_s3_bucket cross-region-replication and versioning sub-resources don't seem to execute in order #828

Closed
hashibot opened this issue Jun 13, 2017 · 6 comments · Fixed by #6095
Labels
bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@hashibot
Copy link

This issue was originally opened by @silvermy as hashicorp/terraform#15093. It was migrated here as part of the provider split. The original body of the issue is below.


Terraform version: 0.9.6

When a aws_s3_bucket resource containing both versioning=true and cross-region-replication, one would expect versioning to be turned on first, as that is a requirement for cross-region-replication.

But, it seems there is a "race condition" of some sort that occasionally leads to the opposite happening, in which case an error is generated saying that cross-region-replication cannot be turned on due to lack of versioning.

Re-running terraform apply does not seem to fix things. Also, the state file seems to believe that the cross-region-replication part has already been completed. The only way we could get things to work was to turn on versioning manually in the console, then remove the replication.* attributes from the bucket resource in the state file, then rerun apply.

@hashibot hashibot added the bug Addresses a defect in current functionality. label Jun 13, 2017
@radeksimko radeksimko added the service/s3 Issues and PRs that pertain to the s3 service. label Jan 27, 2018
@bhperry
Copy link

bhperry commented Sep 24, 2018

I get this issue intermittently as well. However, rerunning the terraform does fix it. Still very annoying though. Would be really nice if the replication setting would just would wait for the versioning to be turned on.

@ewbankkit
Copy link
Contributor

I just hit this while testing #6095:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSS3Bucket_ReplicationSchemaV2'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccAWSS3Bucket_ReplicationSchemaV2 -timeout 120m
=== RUN   TestAccAWSS3Bucket_ReplicationSchemaV2
--- FAIL: TestAccAWSS3Bucket_ReplicationSchemaV2 (32.31s)
    testing.go:527: Step 0 error: Error applying: 1 error occurred:
        	* aws_s3_bucket.bucket: 1 error occurred:
        	* aws_s3_bucket.bucket: Error putting S3 replication configuration: InvalidRequest: Versioning must be 'Enabled' on the bucket to apply a replication configuration
        	status code: 400, request id: 8CF0FE0EEAFE0E05, host id: pQai/yi7xYb/qyD1h0OJ2m3d/BX7xjsoNdROYb2VaBTVVokD1UjUUtQVZjTJY9STTjF9VNpRzYI=
        
        
        
        
FAIL
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	32.329s
GNUmakefile:20: recipe for target 'testacc' failed
make: *** [testacc] Error 1

I can change the call to PutBucketReplication to retry if we get this error.

@bflad
Copy link
Contributor

bflad commented Oct 31, 2018

The above mentioned fix has been merged and will release with version 1.42.0 of the AWS provider, likely later today. 👍

@bflad bflad added this to the v1.42.0 milestone Oct 31, 2018
@silvermy
Copy link

👍

@bflad
Copy link
Contributor

bflad commented Nov 1, 2018

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

@ghost
Copy link

ghost commented Apr 2, 2020

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 and limited conversation to collaborators Apr 2, 2020
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
6 participants