DEV Community

Cover image for Terraform Dynatrace SaaS course: the 3-module training
Span Observer
Span Observer

Posted on Originally published at span.observer

Terraform Dynatrace SaaS course: the 3-module training

Is your Dynatrace SaaS configuration still edited by hand in the UI, with no review and no history, and do you want to describe it as code with Terraform? This free Terraform Dynatrace SaaS course has three modules: install the provider and declare a first resource, import the existing configuration and watch for drift, then deliver everything through a Git pipeline.

The course covers Dynatrace SaaS only. It does not cover Dynatrace Managed, which has its own Monaco Terraform Managed course. It extends the 8-module Monaco Terraform SaaS course: the three modules below are its modules 6, 7 and 8, grouped for readers who want to go straight to Terraform.

Who is this Terraform Dynatrace SaaS course for?

  • Teams already using Terraform for infrastructure who want to add observability configuration to it.
  • SREs and platform engineers who want an alert or SLO change to be reviewed, replayed and rolled back like code.
  • Dynatrace administrators whose configuration already lives in the UI and who want to bring it under control without rewriting everything.

From a reliability angle the stakes are concrete: an alert rule changed without a trace lengthens diagnosis time (MTTR), while a change that is reviewed, tested in development and then promoted reduces the risk of incidents caused by the configuration itself.

What do the 3 modules contain?

Durations are those stated at the top of each module. Each one ends with a hands-on exercise, a quiz and its answers.

Module 1: the provider and the first resource

This module introduces the dynatrace-oss/dynatrace provider from the Terraform Registry, which according to its repository requires Terraform 0.13 or later. It covers installation (declaration in providers.tf, then terraform init), the three SaaS authentication mechanisms (API token, platform token, OAuth client) supplied through environment variables, and the init, plan, apply cycle on a first Settings resource: an automatic tagging rule.

providers.tf file declaring the dynatrace-oss/dynatrace Terraform provider for Dynatrace SaaS at version ~> 1.0

Module 2: import the existing setup and detect drift

This module explains what the Terraform state holds and why an import avoids creating duplicates. It shows how the provider, run as a standalone program, exports an existing configuration as HCL, which options matter (-ref, -import-state, -exclude, -list-exclusions among others), which files to review by hand, then how to detect drift with terraform plan and reuse a configuration from one environment to another.

Module 3: deliver through a Git pipeline

The last module sets out GitOps in four rules: Git describes the desired state, every change goes through a reviewed merge request, a pipeline applies the change, and any gap is fixed in Git. It covers repository layout, the deployment pipeline, where Terraform fits in the same flow as Monaco, pipeline secrets and permissions, deployment traceability and promotion from development to production. It closes with a guide to choosing between Monaco and Terraform by need.

Directory tree of a Dynatrace configuration repository and a Monaco manifest with two environment groups, dev and prod, authenticated by platform token

Each module also states its prerequisites and recalls that it applies to Dynatrace SaaS only. Modules 2 and 3 build on the previous one: the import needs the provider installed and authenticated from module 1, and the pipeline reuses what you exported and imported. If you already know the provider, you can start at module 2, but read the authentication section of module 1 first, since the export uses the same environment variables. Keep your exercise repository from one module to the next so that the pipeline of module 3 has real files to validate and deploy.

Prerequisites and total duration

  • a Dynatrace SaaS test environment (a trial is enough) and permission to create a platform token or an OAuth client;
  • the Terraform CLI, Git and a terminal;
  • for module 3, a hosted Git repository.

Allow about 2 hours 20 minutes of reading and exercises (the sum of the stated durations, spread over a few sessions). Run the exercises on a test environment, never on production, because apply really changes the configuration.

How to follow the course effectively

  1. Follow the module order: import assumes an installed, authenticated provider, and the pipeline assumes both.
  2. Create a dedicated Git repository and commit after each exercise.
  3. Never put a token in a versioned file: use environment variables.
  4. Check every option in the documentation for your provider version: it changes quickly.

To choose your tool, read the Monaco or Terraform comparison. To go further, alerting and dashboards with Terraform and SLOs declared with Terraform show concrete resources.

What about the official documentation?

This course is a community introduction and awards no credential. The reference remains the Configuration as Code page of the Dynatrace documentation and the Terraform provider repository. For a certification, see Dynatrace University.

Frequently asked questions

Is this Terraform Dynatrace SaaS course free?

Yes. The three modules are freely available on the blog. You only need a Dynatrace SaaS test environment for the exercises.

Do I need the Monaco modules first?

No. Module 1 of this course only assumes basic knowledge of configuration as code. The Monaco modules help compare the two tools but are not required.

Does the course apply to Dynatrace Managed?

No. The same provider can also address a Managed cluster, but authentication and configuration types differ. Managed users follow the dedicated Managed course.

Ready to start? Open the module on the Terraform provider for Dynatrace SaaS and go at your own pace.

span.observer is an independent community blog, not affiliated with Dynatrace LLC. This course does not replace the official training and certifications of Dynatrace University. Check features in the official documentation for your version.


Originally published on span.observer. French version: https://span.observer/fr/parcours-terraform-dynatrace-saas/.

Top comments (0)