Skip to content

datadog_integration_aws_account ordering of metrics_config.namespace_filters.exclude_only not idempotent #2912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jtsaito opened this issue Mar 17, 2025 · 1 comment

Comments

@jtsaito
Copy link

jtsaito commented Mar 17, 2025

Datadog Terraform Provider Version

v3.57.0

Terraform Version

1.6.6

What resources or data sources are affected?

This concerns the resource datadog_integration_aws_account. When setting the attribute metrics_config.namespace_filters.exclude_only to a list of namespaces, Terraform accept the input on the first apply. However, after that the resources are shuffled and not sorted alphabetically either. Thus create and update are not idempotent on the attribute.

Observed behaviour

On runnign a plan again (after the first apply) the it shows a re-ordered list.

Expected behaviour

The ordering does not change.

It would be nice if the resource stick to an alphabetic sorting of list items every time instead of using the slightly weird ordering returned by the raw API.

At very least a documenting the order would be helpful.

Example .tf file's metrics_config block:

  metrics_config {
    automute_enabled          = false
    collect_cloudwatch_alarms = false
    collect_custom_metrics    = false
    enabled                   = true

    namespace_filters {
      exclude_only = [
        "AWS/AppStream",
        "AWS/AppSync",
        "AWS/Athena",
        "AWS/CloudHSM",
        "AWS/CodeBuild",
        "AWS/Connect",
        "AWS/DMS",
        "AWS/DX",
        "AWS/ElasticMapReduce",
        "AWS/EFS",
        "AWS/ElasticTranscoder",
        "AWS/MediaConnect",
        "AWS/MediaConvert",
        "AWS/MediaPackage",
        "AWS/MediaTailor",
        "AWS/GameLift",
        "AWS/Inspector",
        "AWS/IoT",
        "AWS/Lex",
        "AWS/AmazonMQ",
        "AWS/Kafka",
        "AWS/Neptune",
        "AWS/OpsWorks",
        "AWS/Polly",
        "AWS/Redshift",
        "AWS/Rekognition",
        "AWS/Route53Resolver",
        "AWS/SWF",
        "AWS/StorageGateway",
        "AWS/Translate",
        "AWS/WorkSpaces",
      ]
    }

Example diff after first apply:

  # datadog_integration_aws_account.databricks-production will be updated in-place
  ~ resource "datadog_integration_aws_account" "foo" {
        id             = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
        # (3 unchanged attributes hidden)

      ~ metrics_config {
            # (4 unchanged attributes hidden)

          ~ namespace_filters {
              ~ exclude_only = [
                  - "AWS/AmazonMQ",
                    "AWS/AppStream",
                    # (6 unchanged elements hidden)
                    "AWS/DX",
                  - "AWS/EFS",
                    "AWS/ElasticMapReduce",
                  + "AWS/EFS",
                    "AWS/ElasticTranscoder",
                  - "AWS/GameLift",
                  - "AWS/Inspector",
                  - "AWS/IoT",
                  - "AWS/Kafka",
                  - "AWS/Lex",
                    "AWS/MediaConnect",
                    # (2 unchanged elements hidden)
                    "AWS/MediaTailor",
                  + "AWS/GameLift",
                  + "AWS/Inspector",
                  + "AWS/IoT",
                  + "AWS/Lex",
                  + "AWS/AmazonMQ",
                  + "AWS/Kafka",
                    "AWS/Neptune",
                    # (9 unchanged elements hidden)
                ]
            }
        }

        # (5 unchanged blocks hidden)
    }

Terraform Configuration Files

Relevant debug or panic output

No response

Expected Behavior

No response

Actual Behavior

No response

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@Shocktrooper
Copy link

Bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants