Skip to content

version 3.44.0 breaks on dynamic datadog_dashboard resource #2597

@jeff-knurek

Description

@jeff-knurek

Datadog Terraform Provider Version

3.44.0

Terraform Version

v1.6.3

What resources or data sources are affected?

datadog_dashboard

Terraform Configuration Files

It's a pretty complex dynamic config that contains a bit of business logic, so can't share the full details, which I know makes it difficult to reproduce. 

locals {
  my_var = [
    {
      title        = "title"
      color        = "vivid_purple"
      app_name     = "app"
      queue        = "queue"
    }
]}

resource "datadog_dashboard" "my_dashboard" {
  title            = "My Dashboard"
  description      = "Created using Terraform"
  layout_type      = "ordered"
  reflow_type      = "auto"
  restricted_roles = ["role-id"]

  dynamic "widget" {
    for_each = local.my_var
    content {

      group_definition {
        background_color = widget.value["color"]
        layout_type      = "ordered"
        show_title       = true
        title            = widget.value["title"]

        widget {
        }
      }
    }
  }

  template_variable {
    name     = "var"
    prefix   = "var"
    defaults = ["value"]
  }
}

Relevant debug or panic output

This is the standard output seen:

│ Error: object contains unparsed element: map[]
│
│   with datadog_dashboard.my_dashboard,
│   on dashboard-util.tf line 107, in resource "datadog_dashboard" "my_dashboard":
│  107: resource "datadog_dashboard" "my_dashboard" {

This is what is available in the debug logs:

2024-10-01T10:38:40.107+0800 [DEBUG] provider.terraform-provider-datadog_v3.44.0
2024-10-01T10:38:42.034+0800 [ERROR] provider.terraform-provider-datadog_v3.44.0: Response contains error diagnostic: diagnostic_summary="object contains unparsed element: map[]" tf_resource_type=datadog_dashboard diagnostic_severity=ERROR diagnostic_detail="" tf_provider_addr=registry.terraform.io/DataDog/datadog tf_rpc=ReadResource @module=sdk.proto tf_proto_version=5.3 tf_req_id=3647bf9c-5fdb-8040-b33d-9d91e0a7abe8 @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagnostics.go:58 timestamp="2024-10-01T10:38:42.034+0800"
2024-10-01T10:38:42.037+0800 [ERROR] vertex "datadog_dashboard.my_dashboard" error: object contains unparsed element: map[]
2024-10-01T10:38:42.037+0800 [ERROR] vertex "datadog_dashboard.my_dashboard (expand)" error: object contains unparsed element: map[]
2024-10-01T10:38:42.037+0800 [INFO]  backend/local: plan operation completed

Expected Behavior

no error, or at least something with a bit more detail to know what is causing the failure

Actual Behavior

terraform exists in error state with no useful information

Steps to Reproduce

The error only shows when the UI version has been changed manually and terraform needs to reset the state. If the change is initiated by a change in the terraform code, the error doesn't show up.

Important Factoids

The workaround found is to rollback to version 3.43.1 (or earlier) with terraform init -upgrade.

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions