From 7c5bbb9ed50226dc7c175f0d2dfe4bd7654b7fbc Mon Sep 17 00:00:00 2001 From: Hanzel Legarda Date: Mon, 7 Sep 2026 15:16:16 -0600 Subject: [PATCH] fix: remove trailing slash from Glue database location_uri Every Glue database this module creates has a trailing slash baked into location_uri. When a downstream Iceberg client creates a table without an explicit LOCATION, it concatenates this database location with "/" + tableName. Some client versions/code paths (Iceberg's HiveCatalog pre-1.11.0, Spark's own default-location resolution - see apache/iceberg#15908, still open) don't strip a trailing slash before doing that concatenation, producing s3://bucket//table instead of s3://bucket/table. This has produced 1,586+ affected tables across data-dw, data-test, and data-corp, owned by 50+ different applications. Fixing each producing application's Iceberg/Spark version individually doesn't scale across that many independent producers. Removing the trailing slash here removes the material every one of those code paths needs to produce a double slash, regardless of which application or library version is creating the table. This is a location_uri-only change (in-place Glue API update, not a resource replacement) and only affects the default location computed for new tables created without an explicit LOCATION going forward. It does not touch any existing table's location or data. --- glue.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glue.tf b/glue.tf index e1841c1..37cd778 100644 --- a/glue.tf +++ b/glue.tf @@ -13,7 +13,7 @@ resource "aws_glue_catalog_database" "apiary_glue_database" { for schema in local.schemas_info : "${schema["schema_name"]}" => schema } : {} - location_uri = "s3://${aws_s3_bucket.apiary_data_bucket[each.key].id}/" + location_uri = "s3://${aws_s3_bucket.apiary_data_bucket[each.key].id}" name = "${local.gluedb_prefix}${each.key}" description = "Managed by Apiary terraform" tags = var.apiary_tags @@ -21,7 +21,7 @@ resource "aws_glue_catalog_database" "apiary_glue_database" { resource "aws_glue_catalog_database" "apiary_system_glue_database" { count = var.disable_glue_db_init ? 1 : 0 - location_uri = "s3://${aws_s3_bucket.apiary_system.id}/" + location_uri = "s3://${aws_s3_bucket.apiary_system.id}" name = "${local.gluedb_prefix}${var.system_schema_name}" description = "Managed by Apiary terraform" tags = var.apiary_tags