Files
terraform/datadog/test-datadog.tf

52 lines
1.0 KiB
HCL

terraform {
required_providers {
datadog = {
source = "DataDog/datadog"
version = "~> 3.0"
}
}
}
# Provider configuration
provider "datadog" {
api_key = var.datadog_api_key
app_key = var.datadog_app_key
api_url = var.datadog_site
}
# Variables
variable "datadog_api_key" {
description = "Datadog API key"
type = string
sensitive = true
}
variable "datadog_app_key" {
description = "Datadog APP key"
type = string
sensitive = true
}
variable "datadog_site" {
description = "Datadog site URL"
type = string
default = "https://api.datadoghq.com"
}
# Example resource - Datadog Monitor
resource "datadog_monitor" "test_monitor" {
name = "Test Monitor"
type = "metric alert"
query = "avg(last_1h):avg:system.cpu.user{*} > 80"
message = "CPU usage is too high"
escalation_message = "Escalation message"
monitor_thresholds {
critical = "80"
}
lifecycle {
ignore_changes = [query] # For testing purposes
}
}