From 7ae8059154b8c1e79f15785378ee8883aafe3d74 Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Sun, 6 Jul 2025 00:31:24 -0400 Subject: [PATCH] s3 table metadata and directory bucket tags --- README.md | 4 ++-- examples/account-public-access/README.md | 2 +- examples/account-public-access/versions.tf | 2 +- examples/complete/README.md | 4 ++-- examples/complete/versions.tf | 2 +- examples/directory-bucket/README.md | 4 ++-- examples/directory-bucket/main.tf | 4 ++++ examples/directory-bucket/versions.tf | 2 +- examples/notification/README.md | 4 ++-- examples/notification/versions.tf | 2 +- examples/object/README.md | 4 ++-- examples/object/versions.tf | 2 +- examples/s3-analytics/README.md | 4 ++-- examples/s3-analytics/versions.tf | 2 +- examples/s3-inventory/README.md | 4 ++-- examples/s3-inventory/versions.tf | 2 +- examples/s3-replication/README.md | 6 ++--- examples/s3-replication/versions.tf | 2 +- examples/table-bucket/README.md | 6 ++--- examples/table-bucket/main.tf | 20 +++++++++++++++- examples/table-bucket/versions.tf | 2 +- main.tf | 2 ++ modules/account-public-access/README.md | 4 ++-- modules/account-public-access/versions.tf | 2 +- modules/notification/README.md | 4 ++-- modules/notification/versions.tf | 2 +- modules/object/README.md | 4 ++-- modules/object/versions.tf | 2 +- modules/table-bucket/README.md | 4 ++-- modules/table-bucket/main.tf | 28 ++++++++++++++++++++++ modules/table-bucket/versions.tf | 2 +- versions.tf | 2 +- wrappers/account-public-access/versions.tf | 2 +- wrappers/notification/versions.tf | 2 +- wrappers/object/versions.tf | 2 +- wrappers/table-bucket/versions.tf | 2 +- wrappers/versions.tf | 2 +- 37 files changed, 101 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 131c44b9..c3ce5d47 100644 --- a/README.md +++ b/README.md @@ -152,13 +152,13 @@ Users of Terragrunt can achieve similar results by using modules provided in the | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.2 | ## Modules diff --git a/examples/account-public-access/README.md b/examples/account-public-access/README.md index 350725f5..35005587 100644 --- a/examples/account-public-access/README.md +++ b/examples/account-public-access/README.md @@ -20,7 +20,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.10 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | | [random](#requirement\_random) | >= 2.0 | ## Providers diff --git a/examples/account-public-access/versions.tf b/examples/account-public-access/versions.tf index 9af58496..22e6a57c 100644 --- a/examples/account-public-access/versions.tf +++ b/examples/account-public-access/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } random = { source = "hashicorp/random" diff --git a/examples/complete/README.md b/examples/complete/README.md index cebfd965..46668897 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -30,14 +30,14 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | | [random](#requirement\_random) | >= 2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.2 | | [random](#provider\_random) | >= 2.0 | ## Modules diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index d2f4f3e8..75a8f40f 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } random = { source = "hashicorp/random" diff --git a/examples/directory-bucket/README.md b/examples/directory-bucket/README.md index 014b77a6..18615625 100644 --- a/examples/directory-bucket/README.md +++ b/examples/directory-bucket/README.md @@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | | [random](#requirement\_random) | >= 2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.2 | | [random](#provider\_random) | >= 2.0 | ## Modules diff --git a/examples/directory-bucket/main.tf b/examples/directory-bucket/main.tf index 75c6e756..b3a13899 100644 --- a/examples/directory-bucket/main.tf +++ b/examples/directory-bucket/main.tf @@ -74,6 +74,10 @@ module "complete" { ] attach_policy = true policy = data.aws_iam_policy_document.bucket_policy.json + + tags = { + directory-bucket = true + } } resource "random_pet" "this" { diff --git a/examples/directory-bucket/versions.tf b/examples/directory-bucket/versions.tf index d2f4f3e8..75a8f40f 100644 --- a/examples/directory-bucket/versions.tf +++ b/examples/directory-bucket/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } random = { source = "hashicorp/random" diff --git a/examples/notification/README.md b/examples/notification/README.md index 0826d128..92e326c9 100644 --- a/examples/notification/README.md +++ b/examples/notification/README.md @@ -20,7 +20,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | | [null](#requirement\_null) | >= 2.0 | | [random](#requirement\_random) | >= 2.0 | @@ -28,7 +28,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.2 | | [null](#provider\_null) | >= 2.0 | | [random](#provider\_random) | >= 2.0 | diff --git a/examples/notification/versions.tf b/examples/notification/versions.tf index f3849b87..046fec1e 100644 --- a/examples/notification/versions.tf +++ b/examples/notification/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } random = { source = "hashicorp/random" diff --git a/examples/object/README.md b/examples/object/README.md index 3ad216fd..7125cb7b 100644 --- a/examples/object/README.md +++ b/examples/object/README.md @@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | | [random](#requirement\_random) | >= 2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.2 | | [random](#provider\_random) | >= 2.0 | ## Modules diff --git a/examples/object/versions.tf b/examples/object/versions.tf index d2f4f3e8..75a8f40f 100644 --- a/examples/object/versions.tf +++ b/examples/object/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } random = { source = "hashicorp/random" diff --git a/examples/s3-analytics/README.md b/examples/s3-analytics/README.md index ab6f2a10..36467b8f 100644 --- a/examples/s3-analytics/README.md +++ b/examples/s3-analytics/README.md @@ -10,14 +10,14 @@ Please check [complete example](https://github.com/terraform-aws-modules/terrafo | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | | [random](#requirement\_random) | >= 2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.2 | | [random](#provider\_random) | >= 2.0 | ## Modules diff --git a/examples/s3-analytics/versions.tf b/examples/s3-analytics/versions.tf index d2f4f3e8..75a8f40f 100644 --- a/examples/s3-analytics/versions.tf +++ b/examples/s3-analytics/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } random = { source = "hashicorp/random" diff --git a/examples/s3-inventory/README.md b/examples/s3-inventory/README.md index c2d64c30..48d7f0ef 100644 --- a/examples/s3-inventory/README.md +++ b/examples/s3-inventory/README.md @@ -10,14 +10,14 @@ Please check [complete example](https://github.com/terraform-aws-modules/terrafo | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | | [random](#requirement\_random) | >= 2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.2 | | [random](#provider\_random) | >= 2.0 | ## Modules diff --git a/examples/s3-inventory/versions.tf b/examples/s3-inventory/versions.tf index d2f4f3e8..75a8f40f 100644 --- a/examples/s3-inventory/versions.tf +++ b/examples/s3-inventory/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } random = { source = "hashicorp/random" diff --git a/examples/s3-replication/README.md b/examples/s3-replication/README.md index 23933c9e..91f418e6 100644 --- a/examples/s3-replication/README.md +++ b/examples/s3-replication/README.md @@ -22,15 +22,15 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | | [random](#requirement\_random) | >= 2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | -| [aws.replica](#provider\_aws.replica) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.2 | +| [aws.replica](#provider\_aws.replica) | >= 6.2 | | [random](#provider\_random) | >= 2.0 | ## Modules diff --git a/examples/s3-replication/versions.tf b/examples/s3-replication/versions.tf index d2f4f3e8..75a8f40f 100644 --- a/examples/s3-replication/versions.tf +++ b/examples/s3-replication/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } random = { source = "hashicorp/random" diff --git a/examples/table-bucket/README.md b/examples/table-bucket/README.md index dff19e52..e46bb2cd 100644 --- a/examples/table-bucket/README.md +++ b/examples/table-bucket/README.md @@ -20,21 +20,21 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | | [random](#requirement\_random) | >= 2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.2 | | [random](#provider\_random) | >= 2.0 | ## Modules | Name | Source | Version | |------|--------|---------| -| [kms](#module\_kms) | terraform-aws-modules/kms/aws | ~> 2.0 | +| [kms](#module\_kms) | terraform-aws-modules/kms/aws | ~> 3.0 | | [table\_bucket](#module\_table\_bucket) | ../../modules/table-bucket | n/a | ## Resources diff --git a/examples/table-bucket/main.tf b/examples/table-bucket/main.tf index 4a6a898a..5b4dadb2 100644 --- a/examples/table-bucket/main.tf +++ b/examples/table-bucket/main.tf @@ -103,6 +103,24 @@ module "table_bucket" { table3 = { format = "ICEBERG" namespace = aws_s3tables_namespace.namespace.namespace + + metadata = { + iceberg = { + schema = { + field = { + created_at = { + name = "created_at" + type = "timestamp" + required = false + } + price = { + type = "decimal(10,2)" + required = false + } + } + } + } + } } } } @@ -118,7 +136,7 @@ resource "aws_s3tables_namespace" "namespace" { module "kms" { source = "terraform-aws-modules/kms/aws" - version = "~> 2.0" + version = "~> 3.0" description = "Key example for s3 table buckets" deletion_window_in_days = 7 diff --git a/examples/table-bucket/versions.tf b/examples/table-bucket/versions.tf index d2f4f3e8..75a8f40f 100644 --- a/examples/table-bucket/versions.tf +++ b/examples/table-bucket/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } random = { source = "hashicorp/random" diff --git a/main.tf b/main.tf index 697aef1a..97441ed1 100644 --- a/main.tf +++ b/main.tf @@ -49,6 +49,8 @@ resource "aws_s3_directory_bucket" "this" { name = var.availability_zone_id type = var.location_type } + + tags = var.tags } resource "aws_s3_bucket_logging" "this" { diff --git a/modules/account-public-access/README.md b/modules/account-public-access/README.md index 722d7ee4..e3960733 100644 --- a/modules/account-public-access/README.md +++ b/modules/account-public-access/README.md @@ -12,13 +12,13 @@ Each AWS account may only have one S3 Public Access Block configuration. | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.2 | ## Modules diff --git a/modules/account-public-access/versions.tf b/modules/account-public-access/versions.tf index db13b0a8..0d66b2d1 100644 --- a/modules/account-public-access/versions.tf +++ b/modules/account-public-access/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } } } diff --git a/modules/notification/README.md b/modules/notification/README.md index 61f1c285..868c750a 100644 --- a/modules/notification/README.md +++ b/modules/notification/README.md @@ -8,13 +8,13 @@ Creates S3 bucket notification resource with all supported types of deliveries: | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.2 | ## Modules diff --git a/modules/notification/versions.tf b/modules/notification/versions.tf index db13b0a8..0d66b2d1 100644 --- a/modules/notification/versions.tf +++ b/modules/notification/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } } } diff --git a/modules/object/README.md b/modules/object/README.md index 1f5e0c95..667cd887 100644 --- a/modules/object/README.md +++ b/modules/object/README.md @@ -8,13 +8,13 @@ Creates S3 bucket objects with different configurations. | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.2 | ## Modules diff --git a/modules/object/versions.tf b/modules/object/versions.tf index db13b0a8..0d66b2d1 100644 --- a/modules/object/versions.tf +++ b/modules/object/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } } } diff --git a/modules/table-bucket/README.md b/modules/table-bucket/README.md index 00302c15..aaf6bbd1 100644 --- a/modules/table-bucket/README.md +++ b/modules/table-bucket/README.md @@ -8,13 +8,13 @@ Creates S3 Table Bucket and Tables with various configurations. | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.2 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.2 | ## Modules diff --git a/modules/table-bucket/main.tf b/modules/table-bucket/main.tf index aac7beef..69afc32d 100644 --- a/modules/table-bucket/main.tf +++ b/modules/table-bucket/main.tf @@ -76,6 +76,34 @@ resource "aws_s3tables_table" "this" { table_bucket_arn = aws_s3tables_table_bucket.this[0].arn encryption_configuration = try(each.value.encryption_configuration, null) maintenance_configuration = try(each.value.maintenance_configuration, null) + + dynamic "metadata" { + for_each = try([each.value.metadata], []) + content { + + dynamic "iceberg" { + for_each = try([metadata.value.iceberg], []) + content { + + dynamic "schema" { + for_each = try([iceberg.value.schema], []) + content { + + dynamic "field" { + for_each = try(schema.value.field, []) + content { + + name = try(field.value.name, field.key) + type = field.value.type + required = try(field.value.required, null) + } + } + } + } + } + } + } + } } resource "aws_s3tables_table_policy" "this" { diff --git a/modules/table-bucket/versions.tf b/modules/table-bucket/versions.tf index db13b0a8..0d66b2d1 100644 --- a/modules/table-bucket/versions.tf +++ b/modules/table-bucket/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } } } diff --git a/versions.tf b/versions.tf index db13b0a8..0d66b2d1 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } } } diff --git a/wrappers/account-public-access/versions.tf b/wrappers/account-public-access/versions.tf index db13b0a8..0d66b2d1 100644 --- a/wrappers/account-public-access/versions.tf +++ b/wrappers/account-public-access/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } } } diff --git a/wrappers/notification/versions.tf b/wrappers/notification/versions.tf index db13b0a8..0d66b2d1 100644 --- a/wrappers/notification/versions.tf +++ b/wrappers/notification/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } } } diff --git a/wrappers/object/versions.tf b/wrappers/object/versions.tf index db13b0a8..0d66b2d1 100644 --- a/wrappers/object/versions.tf +++ b/wrappers/object/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } } } diff --git a/wrappers/table-bucket/versions.tf b/wrappers/table-bucket/versions.tf index db13b0a8..0d66b2d1 100644 --- a/wrappers/table-bucket/versions.tf +++ b/wrappers/table-bucket/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } } } diff --git a/wrappers/versions.tf b/wrappers/versions.tf index db13b0a8..0d66b2d1 100644 --- a/wrappers/versions.tf +++ b/wrappers/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.2" } } }