Open ramimohammad opened 2 years ago
@ramimohammad I came here because I had the same error but I was using a separate "aws_iam_policy_document" resource. It turns out, this comment explains that you need to add a "depends_on" to the cloudtrail resource for that to work correctly: https://github.com/hashicorp/terraform-provider-aws/issues/820#issuecomment-485593305.
In the code you pasted, you show an inline policy but I'm curious if you pasted that in from the providers docs and are actually using the separate policy document resource because the inline policy should work. I used the exact same policy to create the separate policy document and that worked with the "depends_on" in the "aws_cloudtrail" resource.
@rabidscorpio strange, it's not working for me unfortunately with the depends_on
trick.
it's been resolved by allowing ACL on the target S3 bucket as I remember after that try to apply again
Community Note
Terraform CLI and Terraform AWS Provider Version
Terraform v1.2.7 on linux_amd64 provider registry.terraform.io/hashicorp/aws v4.26.0
Affected Resource(s)
Terraform Configuration Files
Debug Output
Expected Behavior
It should create the cloudtrail without issues
Actual Behavior
Steps to Reproduce
terraform apply
Important Factoids
when trying to create cloudtrail directly from aws console without terraform it's created normally.
References
0000