diff --git a/README.md b/README.md
index f20c59a..3be8499 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.0 |
-| [aws](#requirement\_aws) | >= 5.64 |
+| [aws](#requirement\_aws) | >= 5.72.1 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 5.64 |
+| [aws](#provider\_aws) | >= 5.72.1 |
## Modules
@@ -115,6 +115,7 @@ No modules.
| [import\_table](#input\_import\_table) | Configurations for importing s3 data into a new table. | `any` | `{}` | no |
| [local\_secondary\_indexes](#input\_local\_secondary\_indexes) | Describe an LSI on the table; these can only be allocated at creation so you cannot change this definition after you have created the resource. | `any` | `[]` | no |
| [name](#input\_name) | Name of the DynamoDB table | `string` | `null` | no |
+| [on\_demand\_throughput](#input\_on\_demand\_throughput) | Sets the maximum number of read and write units for the specified on-demand table | `any` | `{}` | no |
| [point\_in\_time\_recovery\_enabled](#input\_point\_in\_time\_recovery\_enabled) | Whether to enable point-in-time recovery | `bool` | `false` | no |
| [range\_key](#input\_range\_key) | The attribute to use as the range (sort) key. Must also be defined as an attribute | `string` | `null` | no |
| [read\_capacity](#input\_read\_capacity) | The number of read units for this table. If the billing\_mode is PROVISIONED, this field should be greater than 0 | `number` | `null` | no |
diff --git a/examples/autoscaling/README.md b/examples/autoscaling/README.md
index 02867d0..61dc031 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.0 |
-| [aws](#requirement\_aws) | >= 5.64 |
+| [aws](#requirement\_aws) | >= 5.72.1 |
| [random](#requirement\_random) | >= 2.0 |
## Providers
diff --git a/examples/autoscaling/versions.tf b/examples/autoscaling/versions.tf
index 4382ca0..8672707 100644
--- a/examples/autoscaling/versions.tf
+++ b/examples/autoscaling/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.64"
+ version = ">= 5.72.1"
}
random = {
source = "hashicorp/random"
diff --git a/examples/basic/README.md b/examples/basic/README.md
index 2222b8d..bc5e27c 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.0 |
-| [aws](#requirement\_aws) | >= 5.64 |
+| [aws](#requirement\_aws) | >= 5.72.1 |
| [random](#requirement\_random) | >= 2.0 |
## Providers
diff --git a/examples/basic/main.tf b/examples/basic/main.tf
index 83c5fad..28133e9 100644
--- a/examples/basic/main.tf
+++ b/examples/basic/main.tf
@@ -37,9 +37,19 @@ module "dynamodb_table" {
range_key = "age"
projection_type = "INCLUDE"
non_key_attributes = ["id"]
+
+ on_demand_throughput = {
+ max_write_request_units = 1
+ max_read_request_units = 1
+ }
}
]
+ on_demand_throughput = {
+ max_read_request_units = 1
+ max_write_request_units = 1
+ }
+
tags = {
Terraform = "true"
Environment = "staging"
diff --git a/examples/basic/versions.tf b/examples/basic/versions.tf
index 4382ca0..8672707 100644
--- a/examples/basic/versions.tf
+++ b/examples/basic/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.64"
+ version = ">= 5.72.1"
}
random = {
source = "hashicorp/random"
diff --git a/examples/global-tables/README.md b/examples/global-tables/README.md
index 8392dda..7177002 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.0 |
-| [aws](#requirement\_aws) | >= 5.64 |
+| [aws](#requirement\_aws) | >= 5.72.1 |
| [random](#requirement\_random) | >= 2.0 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 5.64 |
-| [aws.euwest2](#provider\_aws.euwest2) | >= 5.64 |
+| [aws](#provider\_aws) | >= 5.72.1 |
+| [aws.euwest2](#provider\_aws.euwest2) | >= 5.72.1 |
| [random](#provider\_random) | >= 2.0 |
## Modules
diff --git a/examples/global-tables/versions.tf b/examples/global-tables/versions.tf
index 4382ca0..8672707 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 = ">= 5.64"
+ version = ">= 5.72.1"
}
random = {
source = "hashicorp/random"
diff --git a/examples/s3-import/README.md b/examples/s3-import/README.md
index 3ced2e6..496cae9 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.0 |
-| [aws](#requirement\_aws) | >= 5.64 |
+| [aws](#requirement\_aws) | >= 5.72.1 |
| [random](#requirement\_random) | >= 2.0 |
## Providers
diff --git a/examples/s3-import/versions.tf b/examples/s3-import/versions.tf
index 4382ca0..8672707 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 = ">= 5.64"
+ version = ">= 5.72.1"
}
random = {
source = "hashicorp/random"
diff --git a/main.tf b/main.tf
index 6a86765..ffe2303 100644
--- a/main.tf
+++ b/main.tf
@@ -56,6 +56,15 @@ resource "aws_dynamodb_table" "this" {
read_capacity = lookup(global_secondary_index.value, "read_capacity", null)
write_capacity = lookup(global_secondary_index.value, "write_capacity", null)
non_key_attributes = lookup(global_secondary_index.value, "non_key_attributes", null)
+
+ dynamic "on_demand_throughput" {
+ for_each = try([global_secondary_index.value.on_demand_throughput], [])
+
+ content {
+ max_read_request_units = try(on_demand_throughput.value.max_read_request_units, null)
+ max_write_request_units = try(on_demand_throughput.value.max_write_request_units, null)
+ }
+ }
}
}
@@ -106,6 +115,15 @@ resource "aws_dynamodb_table" "this" {
}
}
+ dynamic "on_demand_throughput" {
+ for_each = length(var.on_demand_throughput) > 0 ? [var.on_demand_throughput] : []
+
+ content {
+ max_read_request_units = try(on_demand_throughput.value.max_read_request_units, null)
+ max_write_request_units = try(on_demand_throughput.value.max_write_request_units, null)
+ }
+ }
+
tags = merge(
var.tags,
{
@@ -178,6 +196,15 @@ resource "aws_dynamodb_table" "autoscaled" {
read_capacity = lookup(global_secondary_index.value, "read_capacity", null)
write_capacity = lookup(global_secondary_index.value, "write_capacity", null)
non_key_attributes = lookup(global_secondary_index.value, "non_key_attributes", null)
+
+ dynamic "on_demand_throughput" {
+ for_each = try([global_secondary_index.value.on_demand_throughput], [])
+
+ content {
+ max_read_request_units = try(on_demand_throughput.value.max_read_request_units, null)
+ max_write_request_units = try(on_demand_throughput.value.max_write_request_units, null)
+ }
+ }
}
}
@@ -228,6 +255,15 @@ resource "aws_dynamodb_table" "autoscaled" {
}
}
+ dynamic "on_demand_throughput" {
+ for_each = length(var.on_demand_throughput) > 0 ? [var.on_demand_throughput] : []
+
+ content {
+ max_read_request_units = try(on_demand_throughput.value.max_read_request_units, null)
+ max_write_request_units = try(on_demand_throughput.value.max_write_request_units, null)
+ }
+ }
+
tags = merge(
var.tags,
{
diff --git a/variables.tf b/variables.tf
index 903575e..9b415a6 100644
--- a/variables.tf
+++ b/variables.tf
@@ -180,6 +180,12 @@ variable "ignore_changes_global_secondary_index" {
default = false
}
+variable "on_demand_throughput" {
+ description = "Sets the maximum number of read and write units for the specified on-demand 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 264f62f..2f5fe63 100644
--- a/versions.tf
+++ b/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.64"
+ version = ">= 5.72.1"
}
}
}
diff --git a/wrappers/main.tf b/wrappers/main.tf
index 3833eb9..12e311a 100644
--- a/wrappers/main.tf
+++ b/wrappers/main.tf
@@ -22,6 +22,7 @@ module "wrapper" {
import_table = try(each.value.import_table, var.defaults.import_table, {})
local_secondary_indexes = try(each.value.local_secondary_indexes, var.defaults.local_secondary_indexes, [])
name = try(each.value.name, var.defaults.name, null)
+ on_demand_throughput = try(each.value.on_demand_throughput, var.defaults.on_demand_throughput, {})
point_in_time_recovery_enabled = try(each.value.point_in_time_recovery_enabled, var.defaults.point_in_time_recovery_enabled, false)
range_key = try(each.value.range_key, var.defaults.range_key, null)
read_capacity = try(each.value.read_capacity, var.defaults.read_capacity, null)
diff --git a/wrappers/versions.tf b/wrappers/versions.tf
index 264f62f..2f5fe63 100644
--- a/wrappers/versions.tf
+++ b/wrappers/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.64"
+ version = ">= 5.72.1"
}
}
}