Skip to content

"parse_test_options" argument in "datadog_synthetics_global_variable" broken from Datadog provider version 3.58.0 and above. #3131

@surajdubey08

Description

@surajdubey08

Datadog Terraform Provider Version

v3.58.0

Terraform Version

v1.8.0

What resources or data sources are affected?

datadog_synthetics_global_variable

Terraform Configuration Files

variable.tf:

variable "global_variable" {
  default = {
    name      = "TEST_NAME"
    value     = "HELLO WORLD"
    parse_test_id = "abcd-efgh-ijkl-mnop"
    parse_test_options = {
      type = "http_body"
    }
  }
}

main.tf:

resource "example_resource" "test" {
  name  = var.global_variable.name
  value = var.global_variable.value

  dynamic "parse_test_options" {
    for_each = var.global_variable.parse_test_options != null ? [var.global_variable.parse_test_options] : []
    content {
      type = parse_test_options.value.type
    }
  }
}

Relevant debug or panic output

No response

Expected Behavior

  # module.global_variable.datadog_synthetics_global_variable.global_variable will be created
  + resource "datadog_synthetics_global_variable" "global_variable" {
      + id          = (known after apply)
      + is_fido     = false
      + is_totp     = false
      + name        = "TEST_NAME"
      + secure      = false
      + tags        = []
      + value       = (sensitive value)
        # (1 unchanged attribute hidden)

      + parse_test_options {
          + type = "http_body"
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Actual Behavior

Getting the below error.

╷
│ Error: Value Conversion Error
│
│   with module.global_variable.datadog_synthetics_global_variable.global_variable,
│   on module\global-variable\main.tf line 131, in resource "datadog_synthetics_global_variable" "global_variable":
│  131: resource "datadog_synthetics_global_variable" "global_variable" {
│
│ 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: parse_test_options
│ Target Type: []fwprovider.syntheticsGlobalVariableParseTestOptionsModel
│ Suggested Type: basetypes.ListValue

Steps to Reproduce

Use any Datadog provider version >=3.58.0 with above configuration and while running terraform plan you will get that error.

Use any version <=3.57.0 and the same code will work like a charm.

Important Factoids

This is a breaking BUG from provider version 3.58.0 and above. The same code works well when using provider version <=3.57.0

References

NA

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions