Manage your monitoring as code with Dynatrace’s HashiCorp Terraform integration

We’re excited to announce our verified HashiCorp Terraform integration is now available for Dynatrace customers. HashiCorp’s Terraform is an open-source infrastructure as a code software tool that provides a consistent CLI workflow to manage hundreds of cloud services. Terraform codifies cloud APIs into declarative configuration files. Per HashiCorp, this codification allows infrastructure changes to be automated while keeping the definition human readable. Automated tooling allows operators to increase their productivity, move quicker, and reduce human error.

“With this integration, Dynatrace customers can now leverage Terraform to manage their monitoring infrastructure as code,” said Asad Ali, Senior Director of Sales Engineering at Dynatrace. “This means that, with Terraform, users can automate the deployment of dashboards, custom services, management zones, etc. across their complete Dynatrace instance.”

The Dynatrace integration with Terraform, which can be easily installed via an API connection, marries Dynatrace’s AI-driven software intelligence and observability with any infrastructure managed by Terraform, including Kubernetes, hybrid cloud, and multicloud.

What is monitoring as code?

When it comes to DevOps best practices, practitioners need ways to automate processes and make their day-to-day tasks more efficient. And, when it comes to monitoring the hundreds (often thousands) of services, clouds, and containers deployed – these needs become even more critical to provide full observability to operators. To streamline the observability of these complex environments, monitoring as code provides a way for developers to configure the dashboards and reports they need at the code level. Within the Terraform CLI, users can instrument code to build and run Dynatrace monitoring for the services they’ll deploy from the same CLI. No need to swivel-chair into Dynatrace; everything you need can be created at the code level, where developers are already working.

What are the benefits of monitoring as code?

In addition to not having to leave the Terraform CLI, instrumenting monitoring at the code level is the secret weapon for standardization and scalability. As nobody wants to spend their time repeating the same manual tasks to ensure quality and observability, leveraging the Dynatrace and Terraform integration provides a foundational structure with which developers can execute standardized and automated monitoring. Some of the benefits of monitoring as code include:

  • Having the ability to templatize our configuration for reusability across multiple environments
  • Interdependencies between configurations should be handled without keeping track of unique identifiers
  • Introducing the capability to easily apply, and update, the same configuration to hundreds of Dynatrace environments as well as being able to roll out to specific environments
  • Identify an easy way to promote application-specific configurations from one environment to another – following their deployments from development, to hardening to production.
  • Support all the mechanisms and best practices of git-based workflows such as pull requests, merging, and approvals
  • Configurations should be easily promoted from one environment to another following their deployment from development to hardening to production

How does the Dynatrace Terraform integration work?

Once the integration between Dynatrace and Terraform is configured, leveraging it to automate your Monitoring as Code is easy (and repeatable) – and can all be accomplished through the Terraform CLI.

Step 1: Write
Within the Terraform CLI, users will write the monitoring as code declarative configuration files using HashiCorp Configuration Language (HCL). In this step, users will code in:

  1. the type of monitoring Dynatrace will execute (ex. Dashboards, management zones, custom services)
  2. what data will be collected when monitoring (ex. Service metadata, run location of services, response time, or SLO’s). Doing this at the code level helps developers enforce the observability processes that support the services they’ll deploy, rather than jumping into Dynatrace as an after-thought to retroactively build out the reports they need. It has now become a parallel exercise in the same CLI.

Step 2: Plan
Before deploying monitoring as code, users can run terraform plan to ensure configuration matches expectations before pushing it to production. As Terraform responds with the expected configuration of the user’s monitoring, developers have the opportunity to add, change, or destroy the code. Or, if it matches expectations, move to the third and final step.

Step 3: Apply
Once your configuration in Terraform reaches the desired state, users can easily apply their monitoring deployments – across even the most complex infrastructures. As part of the integration, goal is to make monitoring as code more scalable, users can automatically apply the Dynatrace code-level commands across even the largest environment. No need to repeatedly configure the same dashboards or reports for individual services, containers, or infrastructures; simply execute the Dynatrace deployment alongside anything (and everything) you want to monitor.

Making monitoring as code a reality

By instrumenting monitoring at the code level with the Dynatrace Terraform integration, deploying the dashboards and reports you need for your services, containers, and infrastructure has never been easier.

To get started, get the integration here. And if you’re not an existing Dynatrace user, we encourage you to spin up a free trial and test drive the integration for yourself.

Stay updated