Datadog Terraform Provider Version
v3.91.0 (also reproduces against master at HEAD as of 2026-05-15)
Terraform Version
v1.9.7
What resources or data sources are affected?
datadog_metric_active_tags_and_aggregations (data source)
Terraform Configuration Files
terraform {
required_providers {
datadog = {
source = "DataDog/datadog"
version = "~> 3.91"
}
}
}
provider "datadog" {}
# A metric known to have recent active data points and tags in your org.
# Replace with one that exists in your sandbox.
data "datadog_metric_active_tags_and_aggregations" "example" {
metric = "system.cpu.idle"
}
output "active_tags" {
value = data.datadog_metric_active_tags_and_aggregations.example.active_tags
}
output "active_aggregations" {
value = data.datadog_metric_active_tags_and_aggregations.example.active_aggregations
}
Relevant debug or panic output
datadog_metric_active_tags_and_aggregations data source silently returns empty results because metric_name is sent to the API with literal quotes. There is no panic. The bug is silent: a successful read with empty results.
TF_LOG=DEBUG terraform plan 2>&1 > debug.log
The HTTP request line in the debug output reads (note the URL-encoded literal quotes around the metric name):
GET /api/v2/metrics/%22foo.bar%22/active-configurations
instead of:
GET /api/v2/metrics/foo.bar/active-configurations
Expected Behavior
For any metric with active data points in the last hour (the API's default window), the data source should return populated active_tags and active_aggregations. Calling the /api/v2/metrics/{metric_name}/active-configurations endpoint directly with curl confirms the API itself returns populated data:
curl -sH "DD-API-KEY: $DD_API_KEY" -H "DD-APPLICATION-KEY: $DD_APP_KEY" \
"https://api.datadoghq.com/api/v2/metrics/foo.bar/active-configurations" \
| jq '.data.attributes | {active_tags: (.active_tags | length), active_aggregations: (.active_aggregations | length)}'
{
"active_tags": <non-zero>,
"active_aggregations": <non-zero>
}
Actual Behavior
The data source successfully returns, but active_tags and active_aggregations are always [], regardless of the metric.
$ terraform apply -auto-approve
...
Outputs:
active_aggregations = tolist([])
active_tags = tolist([])
This was confirmed in my testing by exercising the data source against multiple known-active metrics. Both active_tags and active_aggregations returned [] for every tested metric, while the underlying REST endpoint returns populated data when called directly with the unquoted metric name.
Steps to Reproduce
- Save the configuration above as
main.tf.
terraform init
terraform apply -auto-approve
- Observe:
active_tags = tolist([]) and active_aggregations = tolist([]).
- Compare against
curl ... /api/v2/metrics/foo.bar/active-configurations, which returns populated data for the same metric.
Important Factoids
Fixed via #3782
References
Fixed via #3782
Datadog Terraform Provider Version
v3.91.0 (also reproduces against
masterat HEAD as of 2026-05-15)Terraform Version
v1.9.7
What resources or data sources are affected?
datadog_metric_active_tags_and_aggregations(data source)Terraform Configuration Files
Relevant debug or panic output
datadog_metric_active_tags_and_aggregationsdata source silently returns empty results because metric_name is sent to the API with literal quotes. There is no panic. The bug is silent: a successful read with empty results.The HTTP request line in the debug output reads (note the URL-encoded literal quotes around the metric name):
instead of:
Expected Behavior
For any metric with active data points in the last hour (the API's default window), the data source should return populated
active_tagsandactive_aggregations. Calling the/api/v2/metrics/{metric_name}/active-configurationsendpoint directly withcurlconfirms the API itself returns populated data:Actual Behavior
The data source successfully returns, but
active_tagsandactive_aggregationsare always[], regardless of the metric.This was confirmed in my testing by exercising the data source against multiple known-active metrics. Both
active_tagsandactive_aggregationsreturned[]for every tested metric, while the underlying REST endpoint returns populated data when called directly with the unquoted metric name.Steps to Reproduce
main.tf.terraform initterraform apply -auto-approveactive_tags = tolist([])andactive_aggregations = tolist([]).curl ... /api/v2/metrics/foo.bar/active-configurations, which returns populated data for the same metric.Important Factoids
Fixed via #3782
References
Fixed via #3782