terraform-provider-datadog icon indicating copy to clipboard operation
terraform-provider-datadog copied to clipboard

Datadog metric tag configuration must support providing no tags for distribution type metrics

Open rymir opened this issue 2 years ago • 3 comments

Terraform Version

Terraform v1.2.7

provider registry.terraform.io/datadog/datadog v3.13.1

Affected Resource(s)

  • datadog_metric_tag_configuration

Terraform Configuration Files

resource "datadog_metric_tag_configuration" "linkerd_response_latency" {
  metric_name         = "linkerd.response_latency"
  metric_type         = "distribution"
  include_percentiles = true
  tags = []
}

Expected Behavior

Would expect the ability to not provide any tags (omit the field) when configuring datadog distribution metrics, as datadog distribution metrics do not support managing tags and their endpoint fails when including the field.

Actual Behavior

When omitting the tags field, the provider fails with Error: Missing required argument.

When providing an empty list of tags, the provider fails with:

│ Error: error creating MetricTagConfiguration from https://api.datadoghq.com/api/v2/metrics/linkerd.response_latency/tags: 400 Bad Request: {"errors":["Cannot configure tags on metric because metric is an integration metric: linkerd.response_latency."]}

rymir avatar Nov 08 '22 15:11 rymir

Sadly, it is a required field in the underlying API :(

If there was a different way of setting percentiles on a metric without the tag config then it would have been better.

The API seems a bit bloated as its putting it all under "tag configuration"

NasAmin avatar Mar 21 '23 21:03 NasAmin

Any update on this?

NasAmin avatar Sep 11 '23 12:09 NasAmin

Still the case almost 2 years later:

$ terraform version
Terraform v1.9.2
on darwin_amd64
+ provider registry.terraform.io/azure/azapi v1.14.0
+ provider registry.terraform.io/datadog/datadog v3.41.0
+ provider registry.terraform.io/gavinbunney/kubectl v1.14.0
+ provider registry.terraform.io/hashicorp/azurerm v3.111.0
+ provider registry.terraform.io/hashicorp/helm v2.12.1

fabiog1901 avatar Jul 22 '24 19:07 fabiog1901