-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
[Bug]: Inconsistent "Logging: empty output error" with aws_s3_bucket_logging #31139
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
this looks related: |
Noticing something interesting about this issue. Our CI pipeline runs into this bug on nearly every s3 bucket create, but when we run or debug locally we do not hit it. There is a slight difference in environments: CI pipeline:
Local Mac:
I am currently testing this bug on our CI runners and have replicated the issue in the Linux / AMD environment: when we run terraform interactively with In the output from the I have tried going back to earlier versions of the provider but have not found any that do not have this issue. So far, the only workaround I have found is to do this (which is hacky and gross, but required to unblock our pipeline jobs): resource "aws_s3_bucket" "default" {
# ... removed for brevity
}
resource "null_resource" "default" {
provisioner "local-exec" {
command = "sleep 15"
}
triggers = {
bucket = aws_s3_bucket.default.bucket
}
depends_on = [aws_s3_bucket.default]
}
resource "aws_s3_bucket_logging" "default" {
# ... removed for brevity
depends_on = [null_resource.default]
} This seems to hack its way into the time delay being created by the retry logic in the associated PR by waiting 15 seconds after the bucket is created before creating the bucket logging object, and so far in testing this has fixed the aforementioned automated flows that were returning the error. |
@nomeelnoj We're using terratest in our pipeline; a workaround we've implemented is terraformOptions := &terraform.Options{
TerraformDir: tempFolder,
Upgrade: false,
VarFiles: []string{
"fixtures.common.tfvars",
"fixtures.insecure.tfvars",
},
RetryableTerraformErrors: map[string]string{
".*empty output.*": "bug in aws_s3_bucket_logging, intermittent error",
},
MaxRetries: 5,
TimeBetweenRetries: 5 * time.Second,
}
``` |
This functionality has been released in v5.6.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
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. |
Terraform Core Version
1.4.4
AWS Provider Version
v4.65.0
Affected Resource(s)
aws_s3_bucket_logging
Expected Behavior
Consistent association between an s3 bucket and an s3 logging bucket.
Actual Behavior
It's inconsistent. Sometimes the bucket logging resource gets created. sometimes terraform throws an error.
see two linked jobs that are running the same code
success:
https:/defenseunicorns/delivery-aws-iac/actions/runs/4873240123/jobs/8692536806#step:15:3046
failure:
https:/defenseunicorns/delivery-aws-iac/actions/runs/4873239923/jobs/8692535048#step:15:3127
Relevant Error/Panic Output Snippet
Terraform Configuration Files
https:/defenseunicorns/delivery-aws-iac/blob/bug/fix-s3-bucket-empty-output/examples/complete/fixtures.common.tfvars
https:/defenseunicorns/delivery-aws-iac/blob/bug/fix-s3-bucket-empty-output/examples/complete/fixtures.insecure.tfvars
Steps to Reproduce
https:/defenseunicorns/delivery-aws-iac/tree/bug/fix-s3-bucket-empty-output/examples/complete
terraform init
Debug Output
Big debug
see here:
https:/defenseunicorns/delivery-aws-iac/actions/runs/4875889235/jobs/8698678080#step:15:114362
And here's a debug output of a success, same pipeline, same code:
https:/defenseunicorns/delivery-aws-iac/actions/runs/4876410873/jobs/8699861176#step:15:35863
Panic Output
No response
Important Factoids
No response
References
Other location where I've seen the error:
https://discuss.hashicorp.com/t/error-error-reading-s3-bucket-logging-empty-output/38854
Don't seem to be having the error with the now deprecated implementation where logging is configured in the
aws_s3_bucket
resource itselfhttps://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket#logging-1
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: