feat(glue-table): support storage descriptor, partition keys and table parameters - #94
feat(glue-table): support storage descriptor, partition keys and table parameters#94posquit0 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request expands the glue-table module to support additional AWS Glue Catalog Table configurations, including columns, partition keys, SerDe parameters, and storage formats. The review feedback focuses on making the Terraform code more idiomatic and robust. Specifically, it is recommended to default optional string variables like input_format and output_format to null instead of empty strings to simplify validation and resource block assignments. Additionally, the ser_de output should be updated to use splat syntax (*) and flatten for consistency and to prevent potential out-of-bounds errors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| input_format = var.input_format != "" ? var.input_format : null | ||
| output_format = var.output_format != "" ? var.output_format : null |
| default = "" | ||
| nullable = false | ||
|
|
||
| validation { | ||
| condition = contains([ | ||
| "", | ||
| "org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat", | ||
| "com.amazon.emr.cloudtrail.CloudTrailInputFormat", | ||
| "org.apache.hadoop.hive.ql.io.orc.OrcInputFormat", | ||
| "org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat", | ||
| "org.apache.hadoop.mapred.TextInputFormat", | ||
| ], var.input_format) | ||
| error_message = "Supported values for `input_format` are `org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat`, `com.amazon.emr.cloudtrail.CloudTrailInputFormat`, `org.apache.hadoop.hive.ql.io.orc.OrcInputFormat`, `org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat`, `org.apache.hadoop.mapred.TextInputFormat`." | ||
| } |
There was a problem hiding this comment.
Using null as the default value for optional string variables is more idiomatic in Terraform than using an empty string "". This also allows us to simplify the validation block by checking if the variable is null first.
default = null
nullable = true
validation {
condition = var.input_format == null ? true : contains([
"org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat",
"com.amazon.emr.cloudtrail.CloudTrailInputFormat",
"org.apache.hadoop.hive.ql.io.orc.OrcInputFormat",
"org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat",
"org.apache.hadoop.mapred.TextInputFormat",
], var.input_format)
error_message = "Supported values for `input_format` are `org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat`, `com.amazon.emr.cloudtrail.CloudTrailInputFormat`, `org.apache.hadoop.hive.ql.io.orc.OrcInputFormat`, `org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat`, `org.apache.hadoop.mapred.TextInputFormat`."
}
| default = "" | ||
| nullable = false | ||
|
|
||
| validation { | ||
| condition = contains([ | ||
| "", | ||
| "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat", | ||
| "org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat", | ||
| "org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat", | ||
| "org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat", | ||
| ], var.output_format) | ||
| error_message = "Supported values for `output_format` are `org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat`, `org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat`, `org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat`, `org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat`." | ||
| } |
There was a problem hiding this comment.
Using null as the default value for optional string variables is more idiomatic in Terraform than using an empty string "". This also allows us to simplify the validation block by checking if the variable is null first.
default = null
nullable = true
validation {
condition = var.output_format == null ? true : contains([
"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat",
"org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat",
"org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat",
"org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat",
], var.output_format)
error_message = "Supported values for `output_format` are `org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat`, `org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat`, `org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat`, `org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat`."
}
| output "ser_de" { | ||
| description = "The configuration of the SerDe (Serializer/Deserializer) of the table." | ||
| value = one(aws_glue_catalog_table.this.storage_descriptor[0].ser_de_info[*]) | ||
| } |
There was a problem hiding this comment.
Using storage_descriptor[0] is inconsistent with the other outputs in this file which use storage_descriptor[*]. It is also safer to use storage_descriptor[*] combined with flatten to avoid potential index out of bounds errors.
output "ser_de" {
description = "The configuration of the SerDe (Serializer/Deserializer) of the table."
value = one(flatten(aws_glue_catalog_table.this.storage_descriptor[*].ser_de_info))
}
Description
Complete the
glue-tablemodule, which previously only created a bare table (name / description / type). This revives the work from the oldglue-tablebranch (a0ef899) and extends it:storage_descriptorsupport:location,input_format/output_format(with validation),compressed,columns, andser_de(SerDe name / serialization library / parameters)partition_keyssupportparameterssupport — enables Athena partition projection (projection.*,storage.location.template) and other table propertiesUsage
Notes
partition_index,retention,skewed_info,target_table, etc.) are listed in the comment above the resource.