This guide describes how to install the Terraform CLI and set up the Dynatrace Terraform Provider.
Start by installing Terraform on your system as described in the Terraform documentation.
Download the binary according to your operating system.
Set the PATH
to ensure the Terraform binary is accessible system-wide.
Verify the setup by opening a new terminal session and running the following command:
terraform version
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.
terraform {required_providers {dynatrace = {version = "~> 1.0"source = "dynatrace-oss/dynatrace"}}}
Navigate to your working directory in a terminal and execute the following command.
terraform init
You should see output similar to:
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