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

Add support to count in timeboard graphs #47

Closed
dustinblackman opened this issue Jan 31, 2018 · 2 comments
Closed

Add support to count in timeboard graphs #47

dustinblackman opened this issue Jan 31, 2018 · 2 comments

Comments

@dustinblackman
Copy link

dustinblackman commented Jan 31, 2018

I've been experimenting with PRing the ability to add count to the datadog_timeboard graphs in the same way you do terraform resources to make the below example work. I later found the majority of the count logic seems to live in the main terraform executable rather then in each provider so I found myself stuck.

I feel this would be a useful feature. Is there another way to accomplish this? Or could someone point me in the right direction to put make the addition myself please?

Terraform Version

Terraform v0.11.2

  • provider.datadog v1.0.3

Affected Resource(s)

Please list the resources as a list, for example:

  • datadog_timeboard

Terraform Configuration Files

What I'd like to accomplish.

variable "my_list" {
  default = ["First", "Second", "Third"]
}

resource "datadog_timeboard" "my_timeboard" {
  title       = "My Timeboard"
  description = "My Description"
  read_only   = true

  graph {
    count = "${length(var.my_list)}"
    title = "${element(var.my_list, count.index)}"
    viz   = "timeseries"

    request {
      q = "anomalies(sum:mycount{adapter:${element(var.my_list, count.index)}}.as_count().rollup(sum, 3600), 'robust', 4, direction='below')"
    }
  }
}
@ghost
Copy link

ghost commented Feb 10, 2018

Count can't be applied to inner objects, so you'd need to create some object with a count and reference it in the timeboard resource. Offhand, I can't conceptualize how to make a data template work with this, but it might be doable.

I think creating a new graph data source could work, but that's a bit of a weird model because the resource ends up being just a local storage vehicle and not actually existing in the API.

@bkabrda
Copy link
Contributor

bkabrda commented Jun 11, 2019

Seems like this could be solved using the dynamic blocks feature that's been newly introduced in TF 0.12 [1]. I'll create a PR for our docs to present example usage.

[1] https://www.terraform.io/docs/configuration/expressions.html#dynamic-blocks

bkabrda pushed a commit that referenced this issue Jun 11, 2019
Add example on constructing dynamic timeboards. Fixes #47, #64.
jbenais pushed a commit to jbenais/terraform-provider-datadog that referenced this issue Aug 20, 2019
jbenais pushed a commit to jbenais/terraform-provider-datadog that referenced this issue Aug 20, 2019
Add example on constructing dynamic timeboards. Fixes DataDog#47, DataDog#64.
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