DataDog / terraform-provider-datadog

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

Provider 3.39.0 doesn't support `extended_resource_collection_enabled` attribute, but documentation says it does #2382

Closed eduardoasantana closed 7 months ago

eduardoasantana commented 7 months ago

Datadog Terraform Provider Version

v3.39.0

Terraform Version

Any (tested on v1.3.9, 1.7.4, 2

What resources or data sources are affected?

datadog_integration_aws

Terraform Configuration Files

resource "datadog_integration_aws" "datadog_aws_integration" {
  count = var.create_datadog_integration ? 1 : 0

  account_id = data.aws_caller_identity.current.account_id
  role_name  = "datadog-integration-role"

  excluded_regions = local.excluded_regions

  metrics_collection_enabled           = var.enable_datadog_metrics_collection
  extended_resource_collection_enabled = var.enable_datadog_resource_collection
  cspm_resource_collection_enabled     = var.enable_datadog_cspm_resource_collection
}

Relevant debug or panic output

No response

Expected Behavior

The terraform docs say that v3.39.0 of the Datadog provider has deprecated the resource_collection_enabled attribute and replaced it with the extended_resource_collection_enabled attribute. I expected to be able to create an aws integration in Terraform using this new attribute

Actual Behavior

Instead I get the following error:

Unexpected attribute: An attribute named "extended_resource_collection_enabled" is not expected here

If I change the extended_resource_collection_enabled attribute back to the older resource_collection_enabled attribute, I do get a deprecation warning for this attribute when I run a plan.

Screenshot 2024-04-23 at 3 54 01 PM Screenshot from the Datadog provider docs for the datadog_integration_aws resource that shows this is supposed to be the correct new argument. Screenshot 2024-04-23 at 3 55 22 PM

Steps to Reproduce

  1. Create a datadog_integration_aws resource in terraform with the extended_resource_collection_enabled attribute using provider 3.39.0
  2. Run terraform init
  3. Run terraform validate or terraform plan
  4. See error: Screenshot 2024-04-23 at 3 52 14 PM

Important Factoids

Nothing in particular is odd about our AWS set up. We're getting these errors before we even run an apply or touch AWS.

References

extended_resource_collection_enabled

skarimo commented 7 months ago

Hello, you are most likely still using an older version of the provider. As the docs are generated from the schemas directly, I do not see how this can occur. I would suggest running terraform commands with TF_LOG=debug and see which provider version is being used for your module.

HantingZhang2 commented 7 months ago

Hello, you are most likely still using an older version of the provider. As the docs are generated from the schemas directly, I do not see how this can occur. I would suggest running terraform commands with TF_LOG=debug and see which provider version is being used for your module.

The deprecation message is added in the same pr that introduced the new parameter extended_resource_collection_enabled though, I can't reproduce it on my side.

+1 on double checking the provider version when using both parameters.

eduardoasantana commented 7 months ago

You were correct. The terraform workspace had a lock file locally pinning the Datadog provider to v3.38.0. Deleting this file and confirming it was on v3.39.0 made this issue go away. This lock file doesn't exist in source control, so that can explain the weird behavior of getting the error while also seeing a deprecation warning on a plan.

This issue can be closed.