이 페이지는 아직 한국어로 제공되지 않으며 번역 작업 중입니다. 번역에 관한 질문이나 의견이 있으시면 언제든지 저희에게 연락해 주십시오.
Overview
The Datadog Terraform provider allows you to interact with the Datadog API through a Terraform configuration. You can manage your Datadog resources, such as Dashboards, Monitors, Logs Configuration, etc, with this configuration.
Setup
Installation
The Datadog Terraform provider is available through the Terraform Registry
.
Configuration
Install Terraform
Create a directory to contain the Terraform configuration files, for example: terraform_config/
Create a main.tf
file in the terraform_config/
directory with the following content:
terraform {
required_providers {
datadog = {
source = "DataDog/datadog"
}
}
}
# Configure the Datadog provider
provider "datadog" {
api_key = var.datadog_api_key
app_key = var.datadog_app_key
}
Run terraform init
. This initializes the directory for use with Terraform and pulls the Datadog provider.
Create any .tf
file in the terraform_config/
directory and start creating Datadog resources.
Create a monitor
This example demonstrates a monitor.tf
file that creates a live process monitor
.
```
# monitor.tf
resource "datadog_monitor" "process_alert_example" {
name = "Process Alert Monitor"
type = "process alert"
message = "Multiple Java processes running on example-tag"
query = "processes('java').over('example-tag').rollup('count').last('10m') > 1"
monitor_thresholds {
critical = 1.0
critical_recovery = 0.0
}
notify_no_data = false
renotify_interval = 60
}
```
Run terraform apply
to create this monitor in your Datadog account.
Send Events to Datadog
By installing datadogpy
, you have access to the Dogwrap command line tool, which you can use to wrap any Terraform command and bind it to a custom event.
Install datadogpy
:
For more information, see the Datadog Python library
.
Send a terraform apply
event:
dogwrap -n "terraform apply" -k $DD_API_KEY --submit_mode all --tags="source:terraform" "terraform apply -no-color"
Send a terraform destroy
event:
dogwrap -n "terraform destroy" -k $DD_API_KEY --submit_mode all --tags="source:terraform" "terraform destroy -no-color"
Data Collected
Metrics
Terraform does not include any metrics.
Service Checks
Terraform does not include any service checks.
Events
Terraform does not include any events.
Troubleshooting
Need help? Contact Datadog support
.