A simple utility to convert DataDog dashboards and/or monitors to Terraform format.
Requires DATADOG_API_KEY
and DATADOG_APP_KEY
environment variables.
Useful, if you had all dashboards configured adhoc and now want to follow DevOps style :)
Just run (GOPATH and sometimes GOBIN have to be set):
go get -u github.com/jteeuwen/go-bindata/...
go get gopkg.in/zorkian/go-datadog-api.v2
go generate && go build
Export all dashboards:
DATADOG_API_KEY=xxx DATADOG_APP_KEY=xxx ./dd2tf --dashboards
Export one particular dashboard (where 1111
is the ID of the dashboard):
DATADOG_API_KEY=xxx DATADOG_APP_KEY=xxx ./dd2tf --dashboards=1111
Write dashboards to corresponding files:
DATADOG_API_KEY=xxx DATADOG_APP_KEY=xxx ./dd2tf --dashboards --files
By analogy, datadog monitor can be exported with this command:
DATADOG_API_KEY=xxx DATADOG_APP_KEY=xxx ./dd2tf --monitors=1706011
You can find api/app keys in settings, under Integrations -> API
section.