terraform-provider-aws
terraform-provider-aws copied to clipboard
[Enhancement]: Create an Iceberg table with partitions using the aws_glue_catalog_table resource
Description
I would like to be able to create an Iceberg-backed Glue table with partitions using Terraform. The documentation provides instructions to create an Iceberg table. However, here is the output after applying the provided
Terraform configuration with the partition_keys
configuration block populated. We receive the error message "Cannot create partitions in an iceberg table". Iceberg tables can be partitioned using Athena according to the relevant documentation.
Affected Resource(s) and/or Data Source(s)
- aws_glue_catalog_table
Potential Terraform Configuration
provider "aws" {
region = "eu-west-2"
}
resource "aws_s3_bucket" "jc-my-iceberg-bucket" {
bucket = "jc-my-iceberg-bucket"
}
resource "aws_glue_catalog_database" "my_database" {
name = "my_database"
}
resource "aws_glue_catalog_table" "my_test_iceberg_table" {
database_name = aws_glue_catalog_database.my_database.name
name = "my_test_iceberg_table"
description = "An Iceberg table to highlight the issue of creating Iceberg tables using Terraform!"
table_type = "EXTERNAL_TABLE"
parameters = {
format = "parquet"
}
open_table_format_input {
iceberg_input {
metadata_operation = "CREATE"
}
}
storage_descriptor {
location = "s3://${aws_s3_bucket.jc-my-iceberg-bucket.bucket}/iceberg"
input_format = "org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat"
output_format = "org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat"
ser_de_info {
serialization_library = "org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe"
}
columns {
name = "foo"
type = "string"
}
}
partition_keys {
name = "bar"
type = "string"
}
}
References
https://docs.aws.amazon.com/athena/latest/ug/querying-iceberg-creating-tables.html
Would you like to implement a fix?
None