From d0090da3310cb8274c9992f291d5fb60602c54f9 Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Sat, 22 Nov 2025 22:06:58 -0700 Subject: [PATCH] global table witness --- README.md | 5 +++-- examples/autoscaling/README.md | 2 +- examples/autoscaling/versions.tf | 2 +- examples/basic/README.md | 2 +- examples/basic/versions.tf | 2 +- examples/global-tables/README.md | 6 +++--- examples/global-tables/versions.tf | 2 +- examples/s3-import/README.md | 2 +- examples/s3-import/versions.tf | 2 +- main.tf | 8 ++++++++ variables.tf | 8 ++++++++ versions.tf | 2 +- wrappers/main.tf | 1 + wrappers/versions.tf | 2 +- 14 files changed, 32 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 8feaab0..e889485 100644 --- a/README.md +++ b/README.md @@ -68,13 +68,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.13 | +| [aws](#requirement\_aws) | >= 6.22 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.13 | +| [aws](#provider\_aws) | >= 6.22 | ## Modules @@ -111,6 +111,7 @@ No modules. | [create\_table](#input\_create\_table) | Controls if DynamoDB table and associated resources are created | `bool` | `true` | no | | [deletion\_protection\_enabled](#input\_deletion\_protection\_enabled) | Enables deletion protection for table | `bool` | `null` | no | | [global\_secondary\_indexes](#input\_global\_secondary\_indexes) | Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. | `any` | `[]` | no | +| [global\_table\_witness](#input\_global\_table\_witness) | Witness Region in a Multi-Region Strong Consistency deployment. Note This must be used alongside a single replica with consistency\_mode set to STRONG. Other combinations will fail to provision |
object({
region_name = optional(string)
})
| `null` | no | | [hash\_key](#input\_hash\_key) | The attribute to use as the hash (partition) key. Must also be defined as an attribute | `string` | `null` | no | | [ignore\_changes\_global\_secondary\_index](#input\_ignore\_changes\_global\_secondary\_index) | Whether to ignore changes lifecycle to global secondary indices, useful for provisioned tables with scaling | `bool` | `false` | no | | [import\_table](#input\_import\_table) | Configurations for importing s3 data into a new table. | `any` | `{}` | no | diff --git a/examples/autoscaling/README.md b/examples/autoscaling/README.md index b7797a8..fd62ba1 100644 --- a/examples/autoscaling/README.md +++ b/examples/autoscaling/README.md @@ -20,7 +20,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.13 | +| [aws](#requirement\_aws) | >= 6.22 | | [random](#requirement\_random) | >= 2.0 | ## Providers diff --git a/examples/autoscaling/versions.tf b/examples/autoscaling/versions.tf index f68ed7a..6a9817a 100644 --- a/examples/autoscaling/versions.tf +++ b/examples/autoscaling/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.13" + version = ">= 6.22" } random = { source = "hashicorp/random" diff --git a/examples/basic/README.md b/examples/basic/README.md index f39dd5f..062dca3 100644 --- a/examples/basic/README.md +++ b/examples/basic/README.md @@ -20,7 +20,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.13 | +| [aws](#requirement\_aws) | >= 6.22 | | [random](#requirement\_random) | >= 2.0 | ## Providers diff --git a/examples/basic/versions.tf b/examples/basic/versions.tf index f68ed7a..6a9817a 100644 --- a/examples/basic/versions.tf +++ b/examples/basic/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.13" + version = ">= 6.22" } random = { source = "hashicorp/random" diff --git a/examples/global-tables/README.md b/examples/global-tables/README.md index dadf4a8..4898f72 100644 --- a/examples/global-tables/README.md +++ b/examples/global-tables/README.md @@ -20,15 +20,15 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.13 | +| [aws](#requirement\_aws) | >= 6.22 | | [random](#requirement\_random) | >= 2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.13 | -| [aws.euwest2](#provider\_aws.euwest2) | >= 6.13 | +| [aws](#provider\_aws) | >= 6.22 | +| [aws.euwest2](#provider\_aws.euwest2) | >= 6.22 | | [random](#provider\_random) | >= 2.0 | ## Modules diff --git a/examples/global-tables/versions.tf b/examples/global-tables/versions.tf index f68ed7a..6a9817a 100644 --- a/examples/global-tables/versions.tf +++ b/examples/global-tables/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.13" + version = ">= 6.22" } random = { source = "hashicorp/random" diff --git a/examples/s3-import/README.md b/examples/s3-import/README.md index 5ca8bb0..5867be6 100644 --- a/examples/s3-import/README.md +++ b/examples/s3-import/README.md @@ -20,7 +20,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.13 | +| [aws](#requirement\_aws) | >= 6.22 | | [random](#requirement\_random) | >= 2.0 | ## Providers diff --git a/examples/s3-import/versions.tf b/examples/s3-import/versions.tf index f68ed7a..6a9817a 100644 --- a/examples/s3-import/versions.tf +++ b/examples/s3-import/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.13" + version = ">= 6.22" } random = { source = "hashicorp/random" diff --git a/main.tf b/main.tf index 54636e0..02340f1 100644 --- a/main.tf +++ b/main.tf @@ -150,6 +150,14 @@ resource "aws_dynamodb_table" "this" { } } + dynamic "global_table_witness" { + for_each = var.global_table_witness != null ? [var.global_table_witness] : [] + + content { + region_name = global_table_witness.value.region_name + } + } + tags = merge( var.tags, { diff --git a/variables.tf b/variables.tf index 99ad673..6fc67f2 100644 --- a/variables.tf +++ b/variables.tf @@ -233,3 +233,11 @@ variable "region" { type = string default = null } + +variable "global_table_witness" { + description = "Witness Region in a Multi-Region Strong Consistency deployment. Note This must be used alongside a single replica with consistency_mode set to STRONG. Other combinations will fail to provision" + type = object({ + region_name = optional(string) + }) + default = null +} diff --git a/versions.tf b/versions.tf index 8f71cb6..0cf1cd7 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.13" + version = ">= 6.22" } } } diff --git a/wrappers/main.tf b/wrappers/main.tf index 422edc4..d8712a5 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -17,6 +17,7 @@ module "wrapper" { create_table = try(each.value.create_table, var.defaults.create_table, true) deletion_protection_enabled = try(each.value.deletion_protection_enabled, var.defaults.deletion_protection_enabled, null) global_secondary_indexes = try(each.value.global_secondary_indexes, var.defaults.global_secondary_indexes, []) + global_table_witness = try(each.value.global_table_witness, var.defaults.global_table_witness, null) hash_key = try(each.value.hash_key, var.defaults.hash_key, null) ignore_changes_global_secondary_index = try(each.value.ignore_changes_global_secondary_index, var.defaults.ignore_changes_global_secondary_index, false) import_table = try(each.value.import_table, var.defaults.import_table, {}) diff --git a/wrappers/versions.tf b/wrappers/versions.tf index 8f71cb6..0cf1cd7 100644 --- a/wrappers/versions.tf +++ b/wrappers/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.13" + version = ">= 6.22" } } }