AWS S3 bucket creation - Conflicting operation

Hello everyone, I have a terraform script that creates 2 buckets. One for storing objects, and the other one for logging access to that bucket.
Basically I’m creating these resources per bucket:

  • aws_s3_bucket
  • aws_s3_bucket_ownership_controls
  • aws_kms_key
  • aws_kms_alias
  • aws_s3_bucket_policy
  • aws_s3_bucket_server_side_encryption_configuration
  • aws_s3_bucket_versioning
  • aws_s3_bucket_public_access_block
  • aws_s3_bucket_acl
  • aws_s3_bucket_logging

Every time I run the terraform script to create the bucket, I’m getting conflicting errors like this:

Error: creating S3 Bucket (bucket-name) Versioning: operation error S3: PutBucketVersioning, https response error StatusCode: 409, RequestID:, HostID: , api error OperationAborted: A conflicting conditional operation is currently in progress against this resource. Please try again.
│   with module.s3_bucket.aws_s3_bucket_versioning.s3-bucket,
│   on -s3/ line 158, in resource "aws_s3_bucket_versioning" "s3-bucket":
│  158: resource "aws_s3_bucket_versioning" "s3-bucket" {

It’s not always on the same resource, I’ve seen it happen in the object s3 bucket, when creating policies, versioning, keys, and so on. And sometimes it also happens when creating the access-logs bucket.
If I run the script again, it runs successful.

I’ve tried adding depends on all over, but I keep getting the same error. Any ideas on what I can do to solve this?

Thank you so much,


1 Like

This has been resolved in the latest version 5.18.
Released on GitHub but not on Terraform Registry just yet

1 Like

Ahhh. Thanks so much. I’ll try to use the GitHub version to test it.
Actually, any ideas how to test the GitHub version?
I have never done this so not sure what the process is.

Thank you

This is being looked into though

Thank you so much. I just tried using provider 5.18, and it did download, and the terraform script worked! VERY GOOD.
Thank you again.