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.
-
Download the binary according to your operating system.
-
Set the
PATH
to ensure the Terraform binary is accessible system-wide. -
Open a new terminal session and run the command:
1terraform -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.
-
Create a working directory for your Terraform configuration files.
-
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.1terraform {2 required_providers {3 dynatrace = {4 version = <dt-provider-version>5 source = "dynatrace-oss/dynatrace"6 }7 }8} -
Navigate to your working directory in a terminal and execute the following command.
1terraform initYou should see output similar to:
1Initializing the backend...23Initializing provider plugins...4- Finding dynatrace-oss/dynatrace versions matching "x.y.z"...5- Installing dynatrace-oss/dynatrace x.y.z...6- Installed dynatrace-oss/dynatrace x.y.z (signed by a HashiCorp partner, key ID *************)7...89Terraform has been successfully initialized!
Next step: Terraform basic example