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

Provider attempting to remove query metric #2408

Open georgeopenshaw opened 6 months ago

georgeopenshaw commented 6 months ago

Datadog Terraform Provider Version

3.38.0

Terraform Version

1.7.4

What resources or data sources are affected?

resource "datadog_security_monitoring_rule"

Terraform Configuration Files

query {
    aggregation     = "new_value"
    group_by_fields = ["@userIdentity.sessionContext.sessionIssuer.arn"]
    metrics         = ["@requestParameters.roleArn"]
    name            = "name"
    query           = "our query"
  }

Relevant debug or panic output

No response

Expected Behavior

There should be no changes to be applied

Actual Behavior

On every run terraform attempts to remove the metric option from the query

Steps to Reproduce

  1. Create a new value config with a query block as per the Terraform Configuration Files above with a version of the provider that still allows the metric query option
  2. Run terraform apply
  3. Update the terraform provider to the latest verion
  4. Change the configuration to use the metrics list option
  5. Run terraform apply

image

Important Factoids

No response

References

No response

richard-rvvup commented 4 months ago

As a shoddy workaround a lifecycle such as the below "fixes" this:

 lifecycle {
    ignore_changes = [
      query[0].metric,
    ]
  }

But results in deprecated warning:

| Warning: Deprecated attribute
│ 
│   on modules/datadog/siem/rules/cloudtrail_s3_data_plane_events/main.tf line 51, in resource "datadog_security_monitoring_rule" "s3_data_plane":
│   51:       query[0].metric,
│ 
│ The attribute "metric" is deprecated. Refer to the provider documentation for details.