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

datadog_dashboard manage_status_definition displays 'No results found' #454

Closed
0x646e78 opened this issue Mar 18, 2020 · 3 comments
Closed
Labels

Comments

@0x646e78
Copy link

Terraform Version

Terraform 0.12.21
Datadog provider 2.7.0

Affected Resource(s)

  • datadog_dashboard
    • manage_status_definition.

Terraform Configuration Files

resource "datadog_dashboard" "test" {
  title       = "Testing Dashboard Import Bug"
  description = "Monitor Summary should populate"
  layout_type = "free"
  is_read_only   = true

  widget {
    manage_status_definition {
      summary_type = "monitors"
      query = "tag:domain:cnp env:prod"
      sort = "status,asc"
      display_format = "counts"
      color_preference = "background"
      hide_zero_counts = true
      title = "CNP Health Summary"
      title_size = "13"
      title_align = "left"
      show_last_triggered = false
    }
    layout = {
      x = 26
      y = 0
      width = 62
      height = 16
    }
  }
}

Debug Output

https://gist.github.com/0x646e78/186c519f53a9fd33cfbd7d75ddea7152

Panic Output

n/a

Expected Behavior

A dashboard is created with a Monitor Summary widget which displays a count.

Actual Behavior

The Monitor Summary widget is created but reports No results found, but if I Edit Widgets and then enter the 2) Search (i.e. query) field and change anything it works. Note that all I need to do is delete a character and then enter the same one, and it will populate a digit, so it's not that my query is wrong.

Steps to Reproduce

  1. terraform apply

Important Factoids

Works fine using the API directly to create the same thing, with this request body:

{
  "title": "TESTING API",
  "description": "Monitor Summary should populate",
  "layout_type": "free",
  "is_read_only": false,
  "widgets": [
    {
      "definition": {
        "type": "manage_status",
        "query": "tag:domain:cnp env:prod",
        "summary_type": "monitors",
        "sort": "status,asc",
        "display_format": "counts",
        "color_preference": "background",
        "hide_zero_counts": true,
        "show_last_triggered": false,
        "title": "CNP Health Summary",
        "title_size": "13",
        "title_align": "left"
      },
      "layout": {
       "x": 26,
       "y": 0,
       "width": 62,
       "height": 16
      }
    }
  ]
}

https://docs.datadoghq.com/api/?lang=bash#create-a-dashboard

References

Not that I know of.

@nmuesch nmuesch added the bug label Mar 18, 2020
@gruebel
Copy link

gruebel commented Apr 2, 2020

Same problem here! There was a deprecation in #403 of two parameters count and start. And it looks like the count parameter is still needed somehow. Just change your resource definition to

resource "datadog_dashboard" "test" {
  title       = "Testing Dashboard Import Bug"
  description = "Monitor Summary should populate"
  layout_type = "free"
  is_read_only   = true

  widget {
    manage_status_definition {
      summary_type = "monitors"
      query = "tag:domain:cnp env:prod"
      sort = "status,asc"
      display_format = "counts"
      color_preference = "background"
      hide_zero_counts = true
      title = "CNP Health Summary"
      title_size = "13"
      title_align = "left"
      show_last_triggered = false
      count = 50
    }
    layout = {
      x = 26
      y = 0
      width = 62
      height = 16
    }
  }
}

and it should work again.

@bkabrda
Copy link
Contributor

bkabrda commented Apr 28, 2020

Hi, thanks for the issue report! I can reproduce this. The issue seems to be that the due to a quirk in the Terraform SDK, an integer value inside a nested map is always seen internally as 0 even if the field is not specified in the TF config at all.

It seems that the easiest solution that we can do is set a default value for count to 50 (which is basically what the web UI does). I'm discussing this with the monitors team to verify that this is the correct approach. If so, it should be easy to fix.

@bkabrda
Copy link
Contributor

bkabrda commented May 13, 2020

@bkabrda bkabrda closed this as completed May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants