terraform-provider-datadog
terraform-provider-datadog copied to clipboard
Feature Request: Widgets as separate resources for datadog_dashboard resource
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.
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.
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.
My idea would be using the local_file provider as widget content, but I haven't tried it.
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.
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
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