hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.71k stars 9.07k forks source link

[Enhancement]: Logging Improvement: InvalidSignatureException: Signature expired when deploying aws_cloudwatch_log_resource_policy #34683

Open fatbasstard opened 9 months ago

fatbasstard commented 9 months ago

Terraform Core Version

1.6.5

AWS Provider Version

5.29.0

Affected Resource(s)

Expected Behavior

Succesfully create aws_cloudwatch_log_resource_policy when enabling Route53 DNS Query logging

Actual Behavior

Terraform run take pretty long (Plan & apply duration 16 minutes), causing this error to pop up:

Error: creating CloudWatch Logs Resource Policy (route53-query-logging-policy-xxx): operation error CloudWatch Logs: PutResourcePolicy, https response error StatusCode: 400, RequestID: XXX, api error InvalidSignatureException: Signature expired: 20231201T095742Z is now earlier than 20231201T095745Z (20231201T100245Z - 5 min.)

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

https://github.com/schubergphilis/terraform-aws-mcaf-route53-zones/blob/main/dns_query_logging.tf#L27

Steps to Reproduce

Get a big TF plan

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 9 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

dnlopes commented 8 months ago

Also happening to me. Our runs are also moderately long, in this case it blowed up after 8min of an apply.

dnlopes commented 8 months ago

Update: I found out that the issue was on my side. I hit the limit of 10 resource policies per account/region. Apparently this is a hard limit.

It's odd that another person just hit this issue at the same as me, maybe something changed on the error handling here, and instead of blowing up with a 400 right away, Terraform keeps waiting for the resource to be created?

fatbasstard commented 8 months ago

Looked at our setup and it seems to be the limit indeed. So the error is confusing, seems like we hit the resource limit as well.

fatbasstard commented 8 months ago

So the error is valid, the message is annoying. Maybe that can be improved.

Thanks @dnlopes for pointing me in the right direction 👍

justinretzolk commented 7 months ago

Hi @fatbasstard 👋 Thanks for taking the time to raise this, and for the great discussion here. Given that you've found the source of the issue, but it seems like we could do a better job with logging, I've updated the issue a bit.