hashicorp/terraform-provider-aws

[Bug]: aws_emr_cluster Inappropriate value for attribute "configurations": string required.

Open

#39,959 opened on Oct 31, 2024

 (3 comments) (0 reactions) (0 assignees)Go (10,312 forks)github user discovery
documentationgood first issueservice/emr

Repository metrics

Stars
 (11,045 stars)
PR merge metrics
 (Avg merge 19d 21h) (251 merged PRs in 30d)

Description

Terraform Core Version

1.9.8

AWS Provider Version

5.69.0

Affected Resource(s)

While working with EMR, I followed the Terraform guide but encountered an error: Incorrect attribute value type about configurations in aws_emr_cluster.

Could you please confirm this? I would prefer to use this option as it's more readable than configurations_json.

Expected Behavior

working well

Actual Behavior

Incorrect attribute value type occured

Relevant Error/Panic Output Snippet

╷
│ Error: Incorrect attribute value type
│
│   on adhoc_spark.tf line 47, in resource "aws_emr_cluster" "emr_adhoc_spark":
│   47:   configurations = [
│   48:     {
│   49:       classification = "spark-defaults"
│   50:       properties = {
│   51:         "spark.dynamicAllocation.enabled"   = "false"
│   52:         "spark.executor.memory"             = "4g"
│   53:         "spark.emr.default.executor.memory" = "4g"
│   54:         "spark.sql.session.timeZone"        = "Asia/Seoul"
│   55:       }
│   56:     },
│   57:     {
│   58:       classification = "spark-hive-site"
│   59:       properties = {
│   60:         "hive.metastore.client.factory.class" = "com.amazonaws.glue.catalog.metastore.AWSGlueDataCatalogHiveClientFactory"
│   61:       }
│   62:     }
│   63:   ]
│
│ Inappropriate value for attribute "configurations": string required.
╵

Terraform Configuration Files

resource "aws_emr_cluster" "emr_adhoc_spark" {
  ...
  configurations = [
    {
      classification = "spark-defaults"
      properties = {
        "spark.dynamicAllocation.enabled"   = "false"
        "spark.executor.memory"             = "4g"
        "spark.emr.default.executor.memory" = "4g"
        "spark.sql.session.timeZone"        = "Asia/Seoul"
      }
    },
    {
      classification = "spark-hive-site"
      properties = {
        "hive.metastore.client.factory.class" = "com.amazonaws.glue.catalog.metastore.AWSGlueDataCatalogHiveClientFactory"
      }
    }
  ]
}

Steps to Reproduce

  1. write emr configuration
  2. execute terraform plan

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/emr/cluster.go#L308

Would you like to implement a fix?

None

Contributor guide