Error: object contains unparsed element


I am using Terraform to provision and manage resources for AWS Cloud and Datadog integration for my environment. I use the same Terraform configuration for 3 different AWS regions, and the Terraform plan and apply is executed via a pipeline.

Recently, I tried creating a “datadog_logs_archive” resource documented at Terraform Registry to create and manage Datadog logs archives. My requirement is to create this resource only in the us-east-1 region of AWS. So, I have defined this resource and the related s3 bucket resource using the “count” attribute (count = local.region == "us-east-1" ? 1 : 0) to ensure that this resource is only created for us-east-1. the resource definition is as follows:

resource "datadog_logs_archive" "some_logs_archive" {
  count  = local.region == "us-east-1" ? 1 : 0
  depends_on = [aws_s3_bucket.some_log_archival]
  name       = "Application Datadog S3 log archives"
  query      = ""
  s3_archive {
    bucket     = aws_s3_bucket.some_log_archival[0].id
    account_id = "<my_aws_account_id>"
    role_name  =

I started coming across the error:

Error: object contains unparsed element: map[bucket:some-log-archival-pro-us-east-1 integration:map[] path:/some_path type:s3]

during the “terraform plan” command execution. This error points to resource “datadog_logs_archive” definition. After some troubleshooting efforts, I have removed all of the resource definitions related for Datadog logs archival as well as the related s3 bucket resource and the IAM resources. But I still continue to get the “Error: object contains unparsed element” error for the same resource during “terraform plan” (even though the resource definition has been removed from the config).

I have tried “terraform refresh” to address the possible issues related to the state file. But I still continue to get this error.

What might be the cause of the error and how can it be solved.


One update - I tried using an older version of the Datadog provider - 3.7.0 - based on the discussion at object contains unparsed element when using request_basicauth with datadog_synthetics_test · Issue #1335 · DataDog/terraform-provider-datadog · GitHub . But this does not seem to work. Still the same error is observed:

Error: object contains unparsed element: map[bucket:some-log-archival-pro-us-east-1 integration:map path:/some_path type:s3]

Guide to asking for help in this forum - please show your actual errors with all relevant context lines


Welcome to the forum - please reformat your message - the formatting of your code snippets is being mangled by the forum

Hi @yhasabnis,

This error seems to be from the datadog/datadog provider rather than from Terraform itself, and so I’ve moved this into the “Terraform Providers” category. While I was doing that I also tweaked your markup to make the source code more readable, so I’ve effectively done “please reformat your message” as @maxb suggested, but the full context of the error message would help too.

This specific error message text originates in a function inside the provider code:

However, I’m not familiar with DataDog and so I don’t know what exactly an “unparsed element” is; the rule seems to be implemented by some logic in DataDog’s SDK: the ContainsUnparsedObject function.

This function seems to be doing something that’s specific to DataDog’s Go SDK rather than something Terraform-related, so you might wish to contact DataDog for help here as they are hopefully more familiar with their SDK than folks in this forum would be.