Open tomcart90 opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
Got hit by this issue, and apparently, this is not a bug but intended behavior.
When creating metric filters in CloudWatch the specific pattern you use defines whether or not you can use dimensions. The only 2 types of patterns permitted to have dimensions are JSON and space-delimited.
The phrase "space-delimited" is a bit confusing in this context, it refers to patterns that look like this:
[ip, server, username, timestamp, request, status_code, bytes > 1000]
i.e. begin and end with []
and define each field on the row in between.
Read more here: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html#extract-log-event-values Also, you can use the console to being creating a metric filter, and then use the "Test Pattern" button to try and get the correct results, once you do, click on next and check if the UI displays a section at the bottom to add dimensions or not.
Terraform Core Version
v1.3.5
AWS Provider Version
4.50.0
Affected Resource(s)
aws_cloudwatch_log_metric_filter
Expected Behavior
Creating a aws_cloudwatch_log_metric_filter resource with both a valid pattern and dimensions should have succeeded.
Actual Behavior
When creating a aws_cloudwatch_log_metric_filter with dimensions I get the following error:
InvalidParameterException: The specified filter pattern does not support dimensions
Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
Run a terraform apply with the above terraform configuration.
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
I believe this is essentially a duplicate of https://github.com/hashicorp/terraform-provider-aws/issues/22105, though as there has been no response on that issue I figured I'd raise another.
Would you like to implement a fix?
None