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

Always "no_data_timeframe = 0 -> 10" plan is displayed #383

Closed
abicky opened this issue Jan 7, 2020 · 0 comments · Fixed by #384
Closed

Always "no_data_timeframe = 0 -> 10" plan is displayed #383

abicky opened this issue Jan 7, 2020 · 0 comments · Fixed by #384

Comments

@abicky
Copy link
Contributor

abicky commented Jan 7, 2020

Datadog recently seems to have changed the response of monitors with notify_no_data false and we always receive "no_data_timeframe = 0 -> 10" plan in spite of the fact we don't make any changes.

Terraform Version

Terraform v0.12.6

Affected Resource(s)

  • resource_datadog_monitor

Terraform Configuration Files

variable "datadog_api_key" {}
variable "datadog_app_key" {}

provider "datadog" {
  api_key = "${var.datadog_api_key}"
  app_key = "${var.datadog_app_key}"
}

resource "datadog_monitor" "test" {
  name    = "test"
  type    = "metric alert"
  query   = "avg(last_5m):avg:aws.ec2.cpuutilization{*} > 10"
  message = "test"

  notify_no_data = false
}

Debug Output

https://gist.github.com/abicky/efe68a2d0a1cb28ee7e245217731d4db

Expected Behavior

We receive an output like below:

No changes. Infrastructure is up-to-date.

Actual Behavior

We receive an output like below:

Terraform will perform the following actions:

  # datadog_monitor.test will be updated in-place
  ~ resource "datadog_monitor" "test" {
        evaluation_delay    = 0
        id                  = "14793616"
        include_tags        = true
        locked              = false
        message             = "test"
        name                = "test"
        new_host_delay      = 300
      ~ no_data_timeframe   = 0 -> 10
        notify_audit        = false
        notify_no_data      = false
        query               = "avg(last_5m):avg:aws.ec2.cpuutilization{*} > 10"
        renotify_interval   = 0
        require_full_window = true
        silenced            = {}
        tags                = []
        threshold_windows   = {}
        thresholds          = {}
        timeout_h           = 0
        type                = "metric alert"
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Steps to Reproduce

  1. terraform apply
  2. terraform plan

References

abicky referenced this issue in abicky/terraform-provider-datadog Jan 7, 2020
This commit will resolve
https://github.com/terraform-providers/terraform-provider-datadog/issues/383.

Datadog seemed the response of monitors recently changed.
For example, if I execute the following script:

```sh
for monitor_id in $OLD_MONITOR_ID $RECENT_CHANGED_MONITOR_ID; do
  curl -s -X GET \
  -H "DD-API-KEY: ${DATADOG_API_KEY}" \
  -H "DD-APPLICATION-KEY: ${DATADOG_APP_KEY}" \
  -d "group_states=all" \
  "https://api.datadoghq.com/api/v1/monitor/${monitor_id}" | \
  jq '{modified, options: .options | {notify_no_data, no_data_timeframe}}'
done
```

The output is like below:

```
{
  "modified": "2019-09-17T08:08:32.094503+00:00",
  "options": {
    "notify_no_data": false,
    "no_data_timeframe": 10
  }
}
{
  "modified": "2020-01-07T14:06:55.889061+00:00",
  "options": {
    "notify_no_data": false,
    "no_data_timeframe": null
  }
}
```
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

Successfully merging a pull request may close this issue.

1 participant