Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform fails to create aws_cloudwatch_metric_alarm #10987

Open
dcgomesbr opened this issue Nov 23, 2019 · 1 comment
Open

Terraform fails to create aws_cloudwatch_metric_alarm #10987

dcgomesbr opened this issue Nov 23, 2019 · 1 comment
Labels
service/cloudwatch Issues and PRs that pertain to the cloudwatch service. waiting-response Maintainers are waiting on response from community or contributor.

Comments

@dcgomesbr
Copy link

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.11.14

  • provider.archive v1.2.2
  • provider.aws v2.39.0
  • provider.null v2.1.2
  • provider.random v2.2.1
  • provider.template v2.1.2

Affected Resource(s)

  • aws_cloudwatch_metric_alarm

Terraform Configuration Files

resource "aws_cloudwatch_metric_alarm" "errors_alert" {

  actions_enabled     = "true"
  alarm_description   = "Anomaly band (12 / 15 min)"
  alarm_name          = "some_alarm_name"
  comparison_operator = "GreaterThanUpperThreshold"
  datapoints_to_alarm = "1"
  evaluation_periods  = "1"
  treat_missing_data  = "breaching"
  threshold           = "0"
  tags                = "${map("Name","same_name")}"

  metric_query {
    id = "m1"

    metric {
      metric_name = "SomeMetric"
      namespace   = "SomeNamespace"
      period      = "900"
      stat        = "Maximum"

      dimensions = {
        Service = "SomeService"
      }
    }
  }

  metric_query {
    id          = "ad1"
    expression  = "ANOMALY_DETECTION_BAND(m1, 12)"
    label       = "SomeLabel"
    return_data = "true"
  }
}

Debug Output

https://gist.github.com/dcgomesbr/5a47c13c8986bcd712a68ad87daae2d1

Panic Output

None

Expected Behavior

Create the Anomaly Band alarm.

Actual Behavior

aws_cloudwatch_metric_alarm.errors_alert: Creating metric alarm failed: ValidationError: ComparisonOperators for ranges require ThresholdMetricId to be set
status code: 400, request id: 01862480-0be5-4132-a5a3-63ee2e0eb4d1

Steps to Reproduce

Plan and apply the resource above.

Important Factoids

I could create the resource manually and import the state in some cases. In other cases, it insists in re-create the metric.query because of return_data != false and fails the same way.

References

None

@ghost ghost added the service/cloudwatch Issues and PRs that pertain to the cloudwatch service. label Nov 23, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 23, 2019
@justinretzolk
Copy link
Member

Hey @dcgomesbr 馃憢 Thank you for taking the time to file this issue! Given that there's been a number of AWS provider releases since you initially filed it, can you confirm whether you're still experiencing this behavior?

@justinretzolk justinretzolk added waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/cloudwatch Issues and PRs that pertain to the cloudwatch service. waiting-response Maintainers are waiting on response from community or contributor.
Projects
None yet
Development

No branches or pull requests

2 participants