DataDog / terraform-provider-datadog

Terraform Datadog provider
https://www.terraform.io/docs/providers/datadog/
Mozilla Public License 2.0
403 stars 379 forks source link

enable_samples can not be set #2679

Open lexicalunit opened 5 hours ago

lexicalunit commented 5 hours ago

Datadog Terraform Provider Version

v3.48.1

Terraform Version

v1.9.7

What resources or data sources are affected?

resource datadog_monitor

Terraform Configuration Files

resource "datadog_monitor" "my-monitor" {
  name    = my-name
  type    = "ci-tests alert"
  message = OMIT
  query   = OMIT
  monitor_thresholds {
    critical = 1
  }
  enable_logs_sample       = false
  enable_samples           = true
  notify_audit             = false
  on_missing_data          = "default"
  restricted_roles         = null
  renotify_statuses        = ["alert", "no data"]
  renotify_interval        = 240
  escalation_message       = ""
  notification_preset_name = "hide_all"
  priority                 = var.priority
}

Relevant debug or panic output

It seems like the enable_samples is supported, but trying to actually use it just gives this error:

$ terraform validate

[...]

│ Error: Value for unconfigurable attribute
│
│   with module.datadog-dev.datadog_monitor.my-monitor,
│   on ../datadog/test-monitors.tf line 61, in resource "datadog_monitor" "my-monitor":
│   61:   enable_samples           = true
│
│ Can't configure a value for "enable_samples": its value will be decided automatically based on the result of applying this configuration.
╵

Expected Behavior

It should enable this setting in the monitor.

Actual Behavior

It does not work.

Steps to Reproduce

terraform validate

Important Factoids

No response

References

No response

lexicalunit commented 5 hours ago

I think this is the issue: https://github.com/DataDog/terraform-provider-datadog/blob/master/datadog/resource_datadog_monitor.go#L335 -- This value should be optional. However in the code it's showing as computed.