Overview

You can use the Datadog Terraform provider to create and programmatically manage Datadog resources. This guide provides an overview of getting started with Terraform, with links to Terraform resources and tutorials that address specific use cases.

Setup

  1. If you haven’t already, install Terraform.
  2. If you don’t yet have a Terraform configuration file, read the configuration section of the main Terraform documentation to create a directory and configuration file.
  3. From the directory that contains your Datadog Provider configuration, run terraform init.

Resources

Cloud integrations

The AWS integration resource, Azure integration resource, and Google Cloud Project integration resource can establish the connections to quickly get data flowing into your Datadog account from your AWS, Azure, and Google Cloud services, respectively. If you’re using the AWS integration, see the AWS integration with Terraform guide for an example of setting up the integration along with its associated IAM role and permissions.

Logs and Metrics

See the Manage Logs and Metrics with Terraform guide for instructions on managing your logs and metrics with Terraform.

Monitors

With data flowing into your Datadog account, implement alerting with Datadog monitors to be notified about any unexpected changes or anomalous behavior. Use the monitor resource to create and manage your monitors, or use the monitor JSON resource to use JSON definitions for your monitors. See the create a monitor section of the main Terraform documentation for an example monitor.tf file that creates a Live Process monitor.

Account management

See the Manage Datadog with Terraform guide for instructions on managing your Datadog account with Terraform.

Dashboards

To further analyze or display your data for an audience, create Datadog dashboards. Terraform provides the dashboard resource for this, or you can use the dashboard JSON resource to create dashboards with JSON definitions. You can also restrict the editing of a dashboard by configuring restricted roles.

Synthetic tests

  • For API tests, see the Terraform section of the Create An API Test With The API page.
  • For Browser tests, see the Terraform section of the Manage Your Browser Tests Programmatically page.

Webhooks

You can send custom API requests and payloads to your own services in response to the data in your Datadog account with Webhooks. This allows you to alert your services or initiate automated actions in your infrastructure. Use the Terraform Webhook resource to create and manage your webhooks with Terraform.

Go further with Terraform

Follow the Terraform Datadog Provider tutorial for a detailed walk-through of implementing and managing Datadog with Terraform, including the deployment of an example Kubernetes application with the Datadog Agent and the creation of synthetic tests.

Further Reading

Additional helpful documentation, links, and articles: