diff --git a/main.tf b/main.tf index 7fcabe4..0fc0030 100644 --- a/main.tf +++ b/main.tf @@ -1,6 +1,8 @@ locals { enabled = module.this.enabled + table_name = var.table_name != null && var.table_name != "" ? var.table_name : module.this.id + attributes = concat( [ { @@ -45,7 +47,7 @@ resource "null_resource" "local_secondary_index_names" { resource "aws_dynamodb_table" "default" { count = local.enabled ? 1 : 0 - name = module.this.id + name = local.table_name billing_mode = var.billing_mode read_capacity = var.billing_mode == "PAY_PER_REQUEST" ? null : var.autoscale_min_read_capacity write_capacity = var.billing_mode == "PAY_PER_REQUEST" ? null : var.autoscale_min_write_capacity diff --git a/variables.tf b/variables.tf index 5ee1527..f8a57eb 100644 --- a/variables.tf +++ b/variables.tf @@ -123,6 +123,12 @@ variable "autoscaler_tags" { description = "Additional resource tags for the autoscaler module" } +variable "table_name" { + type = string + default = null + description = "Table name. If provided, the bucket will be created with this name instead of generating the name from the context" +} + variable "dynamodb_attributes" { type = list(object({ name = string