amnk / dd2tf

Export DataDog configuration to Terraform
99 stars 39 forks source link
datadog-api terraform

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 :)

How to build

Just run (GOPATH and sometimes GOBIN have to be set):

dep ensure
go generate && go build

go install

Examples

Export all dashboards:

DATADOG_API_KEY=xxx DATADOG_APP_KEY=xxx ./dd2tf dashboards --all

Export one particular dashboard (where 1111 is the ID of the dashboard):

DATADOG_API_KEY=xxx DATADOG_APP_KEY=xxx ./dd2tf dashboards --ids 111

Write dashboards to corresponding files:

DATADOG_API_KEY=xxx DATADOG_APP_KEY=xxx ./dd2tf dashboards --files --all

Datadog monitor can be exported with this command:

DATADOG_API_KEY=xxx DATADOG_APP_KEY=xxx ./dd2tf monitors --ids 1706011

And Datadog Screenboard:

DATADOG_API_KEY=xxx DATADOG_APP_KEY=xxx ./dd2tf screenboards --all

You can find api/app keys in settings, under Integrations -> API section.