From 182c0fb767d7ee36aba4c76dc48397101b3caf54 Mon Sep 17 00:00:00 2001 From: laststem Date: Fri, 12 Sep 2025 17:14:44 +0900 Subject: [PATCH] support warm throughput --- 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 | 36 ++++++++++++++++++++++++++++++ variables.tf | 6 +++++ versions.tf | 2 +- wrappers/main.tf | 1 + wrappers/versions.tf | 2 +- 14 files changed, 58 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index de5ee62..8feaab0 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.9 | +| [aws](#requirement\_aws) | >= 6.13 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.9 | +| [aws](#provider\_aws) | >= 6.13 | ## Modules @@ -137,6 +137,7 @@ No modules. | [timeouts](#input\_timeouts) | Updated Terraform resource management timeouts | `map(string)` |
{
"create": "10m",
"delete": "10m",
"update": "60m"
}
| no | | [ttl\_attribute\_name](#input\_ttl\_attribute\_name) | The name of the table attribute to store the TTL timestamp in | `string` | `""` | no | | [ttl\_enabled](#input\_ttl\_enabled) | Indicates whether ttl is enabled | `bool` | `false` | no | +| [warm\_throughput](#input\_warm\_throughput) | Sets the number of warm read and write units for the specified table | `any` | `{}` | no | | [write\_capacity](#input\_write\_capacity) | The number of write units for this table. If the billing\_mode is PROVISIONED, this field should be greater than 0 | `number` | `null` | no | ## Outputs diff --git a/examples/autoscaling/README.md b/examples/autoscaling/README.md index c6f9092..b7797a8 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.9 | +| [aws](#requirement\_aws) | >= 6.13 | | [random](#requirement\_random) | >= 2.0 | ## Providers diff --git a/examples/autoscaling/versions.tf b/examples/autoscaling/versions.tf index e069a72..f68ed7a 100644 --- a/examples/autoscaling/versions.tf +++ b/examples/autoscaling/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.9" + version = ">= 6.13" } random = { source = "hashicorp/random" diff --git a/examples/basic/README.md b/examples/basic/README.md index 384f85d..f39dd5f 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.9 | +| [aws](#requirement\_aws) | >= 6.13 | | [random](#requirement\_random) | >= 2.0 | ## Providers diff --git a/examples/basic/versions.tf b/examples/basic/versions.tf index e069a72..f68ed7a 100644 --- a/examples/basic/versions.tf +++ b/examples/basic/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.9" + version = ">= 6.13" } random = { source = "hashicorp/random" diff --git a/examples/global-tables/README.md b/examples/global-tables/README.md index 11f282b..dadf4a8 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.9 | +| [aws](#requirement\_aws) | >= 6.13 | | [random](#requirement\_random) | >= 2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.9 | -| [aws.euwest2](#provider\_aws.euwest2) | >= 6.9 | +| [aws](#provider\_aws) | >= 6.13 | +| [aws.euwest2](#provider\_aws.euwest2) | >= 6.13 | | [random](#provider\_random) | >= 2.0 | ## Modules diff --git a/examples/global-tables/versions.tf b/examples/global-tables/versions.tf index e069a72..f68ed7a 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.9" + version = ">= 6.13" } random = { source = "hashicorp/random" diff --git a/examples/s3-import/README.md b/examples/s3-import/README.md index 36f147a..5ca8bb0 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.9 | +| [aws](#requirement\_aws) | >= 6.13 | | [random](#requirement\_random) | >= 2.0 | ## Providers diff --git a/examples/s3-import/versions.tf b/examples/s3-import/versions.tf index e069a72..f68ed7a 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.9" + version = ">= 6.13" } random = { source = "hashicorp/random" diff --git a/main.tf b/main.tf index 66f24cb..54636e0 100644 --- a/main.tf +++ b/main.tf @@ -71,6 +71,15 @@ resource "aws_dynamodb_table" "this" { max_write_request_units = try(on_demand_throughput.value.max_write_request_units, null) } } + + dynamic "warm_throughput" { + for_each = try([global_secondary_index.value.warm_throughput], []) + + content { + read_units_per_second = try(warm_throughput.value.read_units_per_second, null) + write_units_per_second = try(warm_throughput.value.write_units_per_second, null) + } + } } } @@ -132,6 +141,15 @@ resource "aws_dynamodb_table" "this" { } } + dynamic "warm_throughput" { + for_each = length(var.warm_throughput) > 0 ? [var.warm_throughput] : [] + + content { + read_units_per_second = try(warm_throughput.value.read_units_per_second, null) + write_units_per_second = try(warm_throughput.value.write_units_per_second, null) + } + } + tags = merge( var.tags, { @@ -215,6 +233,15 @@ resource "aws_dynamodb_table" "autoscaled" { max_write_request_units = try(on_demand_throughput.value.max_write_request_units, null) } } + + dynamic "warm_throughput" { + for_each = try([global_secondary_index.value.warm_throughput], []) + + content { + read_units_per_second = try(warm_throughput.value.read_units_per_second, null) + write_units_per_second = try(warm_throughput.value.write_units_per_second, null) + } + } } } @@ -275,6 +302,15 @@ resource "aws_dynamodb_table" "autoscaled" { } } + dynamic "warm_throughput" { + for_each = length(var.warm_throughput) > 0 ? [var.warm_throughput] : [] + + content { + read_units_per_second = try(warm_throughput.value.read_units_per_second, null) + write_units_per_second = try(warm_throughput.value.write_units_per_second, null) + } + } + tags = merge( var.tags, { diff --git a/variables.tf b/variables.tf index 942e28e..99ad673 100644 --- a/variables.tf +++ b/variables.tf @@ -192,6 +192,12 @@ variable "on_demand_throughput" { default = {} } +variable "warm_throughput" { + description = "Sets the number of warm read and write units for the specified table" + type = any + default = {} +} + variable "restore_date_time" { description = "Time of the point-in-time recovery point to restore." type = string diff --git a/versions.tf b/versions.tf index fe4021c..8f71cb6 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.9" + version = ">= 6.13" } } } diff --git a/wrappers/main.tf b/wrappers/main.tf index 9bfd996..422edc4 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -47,5 +47,6 @@ module "wrapper" { }) ttl_attribute_name = try(each.value.ttl_attribute_name, var.defaults.ttl_attribute_name, "") ttl_enabled = try(each.value.ttl_enabled, var.defaults.ttl_enabled, false) + warm_throughput = try(each.value.warm_throughput, var.defaults.warm_throughput, {}) write_capacity = try(each.value.write_capacity, var.defaults.write_capacity, null) } diff --git a/wrappers/versions.tf b/wrappers/versions.tf index fe4021c..8f71cb6 100644 --- a/wrappers/versions.tf +++ b/wrappers/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.9" + version = ">= 6.13" } } }