A presentation at Hashicorp & Datadog Webinar in September 2020 in by Daniel "phrawzty" Maher
Observability as Code with Datadog and HashiCorp Terraform
Kerim Satirli Daniel Maher @ksatirli @phrawzty Developer Advocate HashiCorp Developer Advocate Datadog
Agenda ▪ What is Datadog? ▪ What is Terraform? ▪ What is Observability as Code? ▪ How do Datadog and Terraform integrate? ▪ Q&A
app.terraform.io
storedog.example
What is Observability as Code ⁄
How do Datadog and Terraform integrate? ⁄
Datadog Provider for Terraform registry.terraform.io/providers/datadog/datadog
Datadog Provider for Terraform CODE EDITOR terraform { required_providers { datadog = { source = “datadog/datadog” version = “2.13.0” } } required_version = “~> 0.13” }
Datadog Provider for Terraform CODE EDITOR provider “datadog” { # Datadog credentials }
Datadog Provider for Terraform CODE EDITOR provider “datadog” { api_url = “https://api.datadoghq.com/” }
Datadog Provider for Terraform CODE EDITOR ! provider “datadog” { api_url = “https://api.datadoghq.eu/” }
Datadog Monitors Interface app.datadoghq.com/monitors/manage
Datadog Monitor CODE EDITOR resource “datadog_monitor” “high_error_rate” { for_each = var.services name = “HIGH: ${each.key} (${each.value.env})” type = “query alert” message = “${each.key} has a high error rate!” … }
Datadog Monitor CODE EDITOR … query = “avg(last_10m):(sum:trace.$ {each.value.framework}.request.errors{env:$ {each.value.environment},service:${each.key} } / sum:trace.$ {each.value.framework}.request.hits{env:$ {each.value.environment},service:${each.key} }) > $ {each.value.high_error_rate_critical}”
Demonstration ⁄
Resources ▪ Datadog: datadoghq.com/free-datadog-trial ▪ Terraform Cloud: app.terraform.io/signup ▪ Terraform provider: registry.terraform.io/providers/datadog/datadog ▪ webshop code: github.com/datadog/ecommerce-workshop ▪ workshop code: github.com/hashicorp/observability-as-code
Q&A ask us anything (related to today’s session)
Thank You kerim@hashicorp.com daniel.maher@datadoghq.com