Getting Started with Terraform

Overview

You can use Terraform 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 GCP 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.

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

As your team and organization grow, you can use Terraform to scale Datadog to your needs. Create users with the user resource and assign them customized permission sets with the role resource . You can also create and manage your account’s API and application keys through the API key resource and application key resource, as well as adding child organizations with the child organization resource.

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.

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: