terraform-provider-datadog icon indicating copy to clipboard operation
terraform-provider-datadog copied to clipboard

Feature Request: Widgets as separate resources for datadog_dashboard resource

Open pedro-tramontin opened this issue 4 years ago • 6 comments

It would be nice if widgets for datadog_dashboard resource were treated as separated resources. This would allow us to define some base widgets as modules and reuse them in different dashboards. Another usage for it would be to have default dashboards defined as modules and be able to add additional widgets for it.

In our company we created a custom provider that supports this to try it out and because it helped us a lot we would like to have it in the main datadog provider.

pedro-tramontin avatar Mar 16 '21 15:03 pedro-tramontin

Hi,

We don't have such a plan right now. The problem I believe is that it requires both a new widget resource and a new dashboard resource, or at least a new way to declare widgets in dashboard.

We do have a new dashboard resource which is pure JSON though: https://registry.terraform.io/providers/DataDog/datadog/latest/docs/resources/dashboard_json. Would that work for your purpose? Thanks.

therve avatar Mar 16 '21 17:03 therve

Hello,

I will try that one, I was not aware of it.

I am just not sure how I would be able to make it modular, like creating some modules for some default widgets.

pedro-tramontin avatar Mar 18 '21 09:03 pedro-tramontin

My idea would be using the local_file provider as widget content, but I haven't tried it.

therve avatar Mar 18 '21 09:03 therve

Hello @pedro-tramontin I was just wondering if you arrived at a working solution for this? I think I'm hitting the same thing and am in the exploring solutions phase.

jeffWelling avatar Jun 03 '21 23:06 jeffWelling

Seems like this could be done as a data resource, then you could aggregate the output, since the dashboard can be described entirely as json. You can see a similar implementation with AWS IAM policy documents:

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#example-of-merging-source-documents

rmvangun avatar Nov 15 '21 17:11 rmvangun

This seems like a pretty valuable feature, it would help reduce the boiler plate required for setting up dashboards, as widgets could just be imported and combined as needed. But the json resource also seems pretty promising

FarhanSajid1 avatar Aug 15 '23 18:08 FarhanSajid1