Examples of creating dashboards using terraform and the dynatrace_document

Hello community,

I’m attempting to create dashboards using terraform (we arent going down the path of Monaco). I have been told in order to use the new dashboard app,  I would have to use the dynatrace_document which I believe I successfully have. I ensured that I had been using a service accound with all the document related policies. However when creating the dashboard, i am unable to find it on the UI.

I have a feeling it is something to do with sharing. My code is pretty simple.

resource “dynatrace_document” “example_dashboard_v2” {type = "dashboard"name = "Example Dashboard v2"content = local.json_data}and the json{“version”: 15,“variables”: [],“tiles”: {“1”: {“type”: “data”,“title”: “”,“query”: “fetch logs\n| limit 5”,“davis”: {“enabled”: false,“davisVisualization”: { “isAvailable”: true }},“visualization”: “table”,“visualizationSettings”: {“thresholds”: [],“chartSettings”: {“gapPolicy”: “connect”,“circleChartSettings”: {“groupingThresholdType”: “relative”,“groupingThresholdValue”: 0,“valueType”: “relative”},“categoryOverrides”: {}},“singleValue”: {“showLabel”: true,“label”: “”,“prefixIcon”: “”,“recordField”: “timestamp”,“autoscale”: true,“alignment”: “center”,“colorThresholdTarget”: “value”},“table”: {“rowDensity”: “condensed”,“enableSparklines”: false,“hiddenColumns”: [],“lineWrapIds”: [],“columnWidths”: {}},“honeycomb”: {“shape”: “hexagon”,“legend”: “auto”,“dataMappings”: { “value”: “timestamp” },“displayedFields”: [“content”],“colorMode”: “color-palette”,“colorPalette”: “categorical”},“histogram”: { “dataMappings”: [] }},“querySettings”: {“maxResultRecords”: 1000,“defaultScanLimitGbytes”: 500,“maxResultMegaBytes”: 1,“defaultSamplingRatio”: 10,“enableSampling”: false}}},“layouts”: { “1”: { “x”: 0, “y”: 0, “w”: 20, “h”: 6 } },“importedWithCode”: true}Does anyone have good examples of how to do this?

Managed to get the above working now. Essentially I was attempting to create dashboards using a service account (our companies pipelines to run the terraform apply) and we were unable to view the created dashboard.: To overcome this you are to add “private = false” in the resource.  There was also a bug in the dynatrace terraform provider (which has been fixed in  1.65.0)  to ensure that the private flag was fixed

Should it be part of metadata?

“dashboardMetadata”: {                “name”: var.dashboard_name,                “shared”: true,                “owner”: var.owner_email,                “private” = false,                “dashboardFilter”: {                  “timeframe”: “-30d to now”                },                “popularity”: 1,                “hasConsistentColors”: false              },