From 9a2e470b201184af4e88af2c117b0acaa47ade0e Mon Sep 17 00:00:00 2001 From: Ben Galewsky Date: Tue, 30 Jan 2024 10:47:45 -0600 Subject: [PATCH] Make dyanamo table read capacity a variable --- infra/mdf/dev/main.tf | 1 + infra/mdf/modules/dynamo/main.tf | 2 +- infra/mdf/modules/dynamo/variables.tf | 5 +++++ infra/mdf/prod/main.tf | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/infra/mdf/dev/main.tf b/infra/mdf/dev/main.tf index bf4906a1..22de7874 100644 --- a/infra/mdf/dev/main.tf +++ b/infra/mdf/dev/main.tf @@ -47,6 +47,7 @@ module "dynamodb" { env_vars = var.env_vars resource_tags = var.resource_tags dynamodb_write_capacity = 20 + dynamodb_read_capacity = 20 } module "permissions" { diff --git a/infra/mdf/modules/dynamo/main.tf b/infra/mdf/modules/dynamo/main.tf index 29aef280..9cf87f1b 100644 --- a/infra/mdf/modules/dynamo/main.tf +++ b/infra/mdf/modules/dynamo/main.tf @@ -2,7 +2,7 @@ resource "aws_dynamodb_table" "dynamodb-table" { name = "${var.namespace}-${var.env}" billing_mode = "PROVISIONED" - read_capacity = 5 + read_capacity = var.dynamodb_read_capacity write_capacity = var.dynamodb_write_capacity hash_key = "source_id" range_key = "version" diff --git a/infra/mdf/modules/dynamo/variables.tf b/infra/mdf/modules/dynamo/variables.tf index 92478ad7..91e44471 100644 --- a/infra/mdf/modules/dynamo/variables.tf +++ b/infra/mdf/modules/dynamo/variables.tf @@ -21,4 +21,9 @@ variable "resource_tags" { variable "dynamodb_write_capacity" { type = number description = "The write capacity for the DynamoDB table." +} + +variable "dynamodb_read_capacity" { + type = number + description = "The read capacity for the DynamoDB table." } \ No newline at end of file diff --git a/infra/mdf/prod/main.tf b/infra/mdf/prod/main.tf index 2a73cbea..2c194255 100644 --- a/infra/mdf/prod/main.tf +++ b/infra/mdf/prod/main.tf @@ -46,6 +46,7 @@ module "dynamodb" { env_vars = var.env_vars resource_tags = var.resource_tags dynamodb_write_capacity = 20 + dynamodb_read_capacity = 20 } module "permissions" {