I have the following Terraform configuration to create an AWS Athena Iceberg table:
resource "aws_glue_catalog_table" "my_table" {
name = "my_table"
database_name = "my_db"
table_type = "TABLE"
parameters = {
"table_type" = "iceberg"
}
storage_descriptor {
location = "s3://my_data/my_table"
input_format = "org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat"
output_format = "org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat"
ser_de_info {
name = "my-table-stream"
serialization_library = "org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe"
parameters = {
"serialization.format" = 1
}
}
columns {
name = "some_date"
type = "date"
}
columns {
name = "some_name"
type = "string"
}
columns {
name = "some_count"
type = "bigint"
}
}
}
when that is run the table is created as expected. However when I run select * from my_table
from the Athena Query Editor I get the following error:
GENERIC_USER_ERROR: Detected Iceberg type table without metadata location. Please make sure an Iceberg-enabled compute engine such as Athena or EMR Spark is used to create the table, or the table is created by using the Iceberg open source library. Setting table_type parameter in Glue metastore to create an Iceberg table is not supported.
How to properly configure an Athena Iceberg table with Terraform?