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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Allow self-referencing in datadog_monitor #74

Closed
ghost opened this issue Jun 11, 2018 · 2 comments
Closed

Feature Request: Allow self-referencing in datadog_monitor #74

ghost opened this issue Jun 11, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 11, 2018

This issue was originally opened by @hryamzik as hashicorp/terraform#18226. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.11.5
+ provider.datadog v1.0.3

Terraform Configuration Files

resource "datadog_monitor" "disk" {
  name                = "Disk"
  type                = "metric alert"
  query               = "avg(last_5m):avg:system.disk.in_use{device:/dev/ad1s1} > ${datadog_monitor.disk.thresholds.critical}"
  message             = "test"

  thresholds {
    warning           = 0.1
    critical          = 0.7
  }
}

Debug Output

Error: datadog_monitor.disk: datadog_monitor.disk: self reference not allowed: "datadog_monitor.disk.thresholds.critical"

Expected Behavior

Working without errors... The problem here is that critical must mach value in a queue so currently it has to be updated in two places for the same resource.

Steps to Reproduce

  1. terraform init
  2. terraform apply

References

@masci
Copy link
Contributor

masci commented Jul 6, 2018

Allowing self references is a feature that should be added upstream.
In the meantime, you can use this workaround

locals {
  disk_critical = 0.8
}

resource "datadog_monitor" "disk" {
  name                = "Disk"
  type                = "metric alert"
  query               = "avg(last_5m):avg:system.disk.in_use{device:/dev/ad1s1} > ${local.disk_critical}"
  message             = "test"

  thresholds {
    warning           = 0.1
    critical          = "${local.disk_critical}"
  }
}

Closing this.

@masci masci closed this as completed Jul 6, 2018
@coretemp
Copy link

coretemp commented Nov 23, 2018

Can this be reopened?

I want to link to the dashboard id in the message, but that is not allowed.

Error: datadog_monitor.mine: datadog_monitor.mine: self reference not allowed: "datadog_monitor.mine.id"

Why should it have to be added upstream? It's just a matter of creating a monitor and then changing it to inject the id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants