Skip to content
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

datadog_integration_cloudflare_account resource doesn't handle optional parameters correctly #2721

Open
tpickett66 opened this issue Dec 16, 2024 · 0 comments · May be fixed by #2724
Open
Labels

Comments

@tpickett66
Copy link

Datadog Terraform Provider Version

v3.49.0

Terraform Version

v1.10.2

What resources or data sources are affected?

  • datadog_integration_cloudflare_account

Terraform Configuration Files

terraform {
  required_version = ">= 1.4.0"

  required_providers {
    datadog = {
      version = "~> 3.12"
      source  = "DataDog/datadog"
    }

    sops = {
      source  = "carlpett/sops"
      version = ">= 0.5, < 2.0"
    }
  }
}

provider "datadog" {
  api_key = data.aws_secretsmanager_secret_version.datadog_api_key.secret_string
  app_key = data.aws_secretsmanager_secret_version.datadog_app_key.secret_string
}

resource "datadog_integration_cloudflare_account" "production" {
  api_key = data.sops_file.secrets.data["cloudflare.token"]
  name    = "production"

  // These are supposed to be optional but the provider chokes w/o them
  email     = ""
  resources = ["web", "dns", "lb", "worker"] # Order matters here
}

Relevant debug or panic output

Without any optional parameters

│ Error: Value Conversion Error

│ with datadog_integration_cloudflare_account.production,
│ on cloudflare.tf line 1, in resource "datadog_integration_cloudflare_account" "production":
│ 1: resource "datadog_integration_cloudflare_account" "production" {

│ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:

│ Received unknown value, however the target type cannot handle unknown values. Use the corresponding types package type or a custom type that handles unknown values.

│ Path:
│ Target Type: []string
│ Suggested Type: basetypes.ListValue

With resources set to ["web","dns","worker"]

│ Error: Provider produced inconsistent result after apply

│ When applying changes to datadog_integration_cloudflare_account.production, provider "provider["registry.terraform.io/datadog/datadog"]" produced an unexpected new value: .email: was
│ null, but now cty.StringVal("").

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

After changing resources to ["dns", "lb", "web", "worker"]

│ Error: Provider produced inconsistent result after apply

│ When applying changes to datadog_integration_cloudflare_account.production, provider "provider["registry.terraform.io/datadog/datadog"]" produced an unexpected new value: .resources[0]:
│ was cty.StringVal("dns"), but now cty.StringVal("web").

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.


│ Error: Provider produced inconsistent result after apply

│ When applying changes to datadog_integration_cloudflare_account.production, provider "provider["registry.terraform.io/datadog/datadog"]" produced an unexpected new value: .resources[1]:
│ was cty.StringVal("lb"), but now cty.StringVal("dns").

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.


│ Error: Provider produced inconsistent result after apply

│ When applying changes to datadog_integration_cloudflare_account.production, provider "provider["registry.terraform.io/datadog/datadog"]" produced an unexpected new value: .resources[2]:
│ was cty.StringVal("web"), but now cty.StringVal("lb").

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Expected Behavior

  • No error occurs when the email field is unset.
  • No error occurs when the resources field is unset, defaulting to all resources enabled.
  • No reordering of the resources list should occur.

Actual Behavior

Many errors were reported by Terraform, some of which prevented the resource from being created when inputs were marked as optional.

Steps to Reproduce

  1. Comment out the email and resources inputs and run apply to replicate the first error
  2. add the email input to replicate the second error

Important Factoids

No response

References

No response

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