• Home
  • Manage
  • Dynatrace Configuration as Code
  • Dynatrace Configuration as Code via Terraform
  • Install

Install CLI and Terraform Provider

This guide describes how to install the Terraform CLI and set up the Dynatrace Terraform Provider.

Install Terraform CLI

To integrate Dynatrace with Terraform, start by installing Terraform on your system as described in Terraform documentation.

  1. Download the binary according to your operating system.

  2. Set the PATH to ensure the Terraform binary is accessible system-wide.

  3. Open a new terminal session and run the command:

    bash
    terraform -help

Set up the Dynatrace Terraform Provider

The Dynatrace Provider is available in the Terraform Registry and can be fetched automatically during the terraform init process.

  1. Create a working directory for your Terraform configuration files.

  2. Within this directory, create a providers.tf file. Use the configuration block below and make sure to replace <dt-provider-version> with the latest release version of the Dynatrace provider.

    plaintext
    terraform { required_providers { dynatrace = { version = <dt-provider-version> source = "dynatrace-oss/dynatrace" } } }
  3. Navigate to your working directory in a terminal and execute the following command.

    bash
    terraform init

    You should see output similar to:

    plaintext
    Initializing the backend... Initializing provider plugins... - Finding dynatrace-oss/dynatrace versions matching "x.y.z"... - Installing dynatrace-oss/dynatrace x.y.z... - Installed dynatrace-oss/dynatrace x.y.z (signed by a HashiCorp partner, key ID *************) ... Terraform has been successfully initialized!

Next step: Terraform basic example