[Docs]: Race Condition in Example Cloudtrail Creation #27945
Labels
documentation
Introduces or discusses updates to documentation.
eventual-consistency
Pertains to eventual consistency issues.
service/cloudtrail
Issues and PRs that pertain to the cloudtrail service.
Milestone
Documentation Link
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudtrail
Description
When following the example you can hit a race condition - if terraform tries to create the Cloudtrail resource before the aws_s3_bucket_policy has finished creating, the creation of the cloudtrail resource fails with an "InsufficientS3BucketPolicyException".
In my own use of this, I have added the following to the cloudtrail resource:
depends_on = [
aws_s3_bucket_policy.foo
]
That ensures that it waits till the policy is in place before trying to create it.
That would mean the fix here would be changing the Basic example to the following:
The text was updated successfully, but these errors were encountered: