Skip to content

[Enhancement]: Option in aws_cloudwatch_metric_alarm to set up alarm without SCHEMA() Β #27613

Closed as not planned
@balintbako

Description

Description

Setting the namespace in an aws_cloudwatch_metric_alarm automatically sets the SCHEMA in the alert's query.
Therefore, it is not possible to set an alarm query with "No schema".
It would be good to have control over this.

The example code on https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm
creates the following metric query (which actually doesn't return any data due to this exact thing).

SELECT AVG(CPUUtilization) FROM SCHEMA("AWS/EC2")

What would be preferred:

SELECT AVG(CPUUtilization) FROM "AWS/EC2"

The sample code from the URL above:

resource "aws_cloudwatch_metric_alarm" "foobar" {
  alarm_name                = "terraform-test-foobar5"
  comparison_operator       = "GreaterThanOrEqualToThreshold"
  evaluation_periods        = "2"
  metric_name               = "CPUUtilization"
  namespace                 = "AWS/EC2"
  period                    = "120"
  statistic                 = "Average"
  threshold                 = "80"
  alarm_description         = "This metric monitors ec2 cpu utilization"
  insufficient_data_actions = []
}

Affected Resource(s) and/or Data Source(s)

aws_cloudwatch_metric_alarm

Potential Terraform Configuration

No response

References

https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch-metrics-insights-querylanguage.html

Would you like to implement a fix?

No response

Metadata

Assignees

No one assigned

    Labels

    enhancementRequests to existing resources that expand the functionality or scope.service/cloudwatchIssues and PRs that pertain to the cloudwatch service.staleOld or inactive issues managed by automation, if no further action taken these will get closed.upstreamAddresses functionality related to the cloud provider.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions