Template: terraform import <datadog-resource-name>.<name-that-we-give-to-the-resource>.<resource-id>
Example for monitors:
terraform import datadog_monitor.sidekiq_queued_jobs_express 2250497
- Get the JSON from the UI or use the API
- Save it to a file e.g. monitor1.json
- Run this command (requires json2hcl installed):
json2hcl < monitor1.json | sed -e 's/\"name\"/name/g' -e 's/\"type\"/type/g' -e 's/\"query\"/query/g' -e 's/\"message\"/message/g' -e 's/\"options\"/options/g' -e 's/\"notify_audit\"/notify_audit/g' -e 's/\"locked\"/locked/g' -e 's/\"timeout_h\"/timeout_h/g' -e 's/\"silenced\"/silenced/g' -e 's/\"include_tags\"/include_tags/g' -e 's/\"no_data_timeframe\"/no_data_timeframe/g' -e 's/\"new_host_delay\"/new_host_delay/g' -e 's/\"require_full_window\"/require_full_window/g' -e 's/\"notify_no_data\"/notify_no_data/g' -e 's/\"renotify_interval\"/renotify_interval/g' -e 's/\"thresholds\"/thresholds/g' -e 's/\"critical\"/critical/g'