diff --git a/README.md b/README.md
index 86050f8..0cc8f1d 100644
--- a/README.md
+++ b/README.md
@@ -232,14 +232,14 @@ Available targets:
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 0.13.0 |
-| [aws](#requirement\_aws) | >= 4.22 |
+| [aws](#requirement\_aws) | >= 4.59 |
| [null](#requirement\_null) | >= 2.0 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 4.22 |
+| [aws](#provider\_aws) | >= 4.59 |
| [null](#provider\_null) | >= 2.0 |
## Modules
@@ -273,6 +273,7 @@ Available targets:
| [autoscaler\_tags](#input\_autoscaler\_tags) | Additional resource tags for the autoscaler module | `map(string)` | `{}` | no |
| [billing\_mode](#input\_billing\_mode) | DynamoDB Billing mode. Can be PROVISIONED or PAY\_PER\_REQUEST | `string` | `"PROVISIONED"` | no |
| [context](#input\_context) | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional\_tag\_map, which are merged. | `any` |
{| no | +| [deletion\_protection\_enabled](#input\_deletion\_protection\_enabled) | Enable/disable DynamoDB table deletion protection | `bool` | `false` | no | | [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"descriptor_formats": {},
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_key_case": null,
"label_order": [],
"label_value_case": null,
"labels_as_tags": [
"unset"
],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {},
"tenant": null
}
list(object({| `[]` | no | diff --git a/docs/terraform.md b/docs/terraform.md index 755bef7..5669dc5 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -4,14 +4,14 @@ | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.13.0 | -| [aws](#requirement\_aws) | >= 4.22 | +| [aws](#requirement\_aws) | >= 4.59 | | [null](#requirement\_null) | >= 2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.22 | +| [aws](#provider\_aws) | >= 4.59 | | [null](#provider\_null) | >= 2.0 | ## Modules @@ -45,6 +45,7 @@ | [autoscaler\_tags](#input\_autoscaler\_tags) | Additional resource tags for the autoscaler module | `map(string)` | `{}` | no | | [billing\_mode](#input\_billing\_mode) | DynamoDB Billing mode. Can be PROVISIONED or PAY\_PER\_REQUEST | `string` | `"PROVISIONED"` | no | | [context](#input\_context) | Single object for setting entire context at once.
name = string
type = string
}))
{| no | +| [deletion\_protection\_enabled](#input\_deletion\_protection\_enabled) | Enable/disable DynamoDB table deletion protection | `bool` | `false` | no | | [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"descriptor_formats": {},
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_key_case": null,
"label_order": [],
"label_value_case": null,
"labels_as_tags": [
"unset"
],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {},
"tenant": null
}
list(object({| `[]` | no | diff --git a/main.tf b/main.tf index cda1c96..993e38f 100644 --- a/main.tf +++ b/main.tf @@ -44,17 +44,17 @@ resource "null_resource" "local_secondary_index_names" { } resource "aws_dynamodb_table" "default" { - count = local.enabled ? 1 : 0 - name = module.this.id - 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 - hash_key = var.hash_key - range_key = var.range_key - stream_enabled = length(var.replicas) > 0 ? true : var.enable_streams - stream_view_type = length(var.replicas) > 0 || var.enable_streams ? var.stream_view_type : "" - table_class = var.table_class - + count = local.enabled ? 1 : 0 + name = module.this.id + 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 + hash_key = var.hash_key + range_key = var.range_key + stream_enabled = length(var.replicas) > 0 ? true : var.enable_streams + stream_view_type = length(var.replicas) > 0 || var.enable_streams ? var.stream_view_type : "" + table_class = var.table_class + deletion_protection_enabled = var.deletion_protection_enabled server_side_encryption { enabled = var.enable_encryption @@ -132,9 +132,9 @@ module "dynamodb_autoscaler" { attributes = concat(module.this.attributes, var.autoscaler_attributes) tags = var.tags_enabled ? merge(module.this.tags, var.autoscaler_tags) : null - dynamodb_table_name = join("", aws_dynamodb_table.default.*.id) - dynamodb_table_arn = join("", aws_dynamodb_table.default.*.arn) - dynamodb_indexes = null_resource.global_secondary_index_names.*.triggers.name + dynamodb_table_name = join("", aws_dynamodb_table.default[*].id) + dynamodb_table_arn = join("", aws_dynamodb_table.default[*].arn) + dynamodb_indexes = null_resource.global_secondary_index_names[*].triggers.name autoscale_write_target = var.autoscale_write_target autoscale_read_target = var.autoscale_read_target autoscale_min_read_capacity = var.autoscale_min_read_capacity diff --git a/outputs.tf b/outputs.tf index 8a90ac1..93765b5 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,34 +1,34 @@ output "table_name" { - value = join("", aws_dynamodb_table.default.*.name) + value = join("", aws_dynamodb_table.default[*].name) description = "DynamoDB table name" } output "table_id" { - value = join("", aws_dynamodb_table.default.*.id) + value = join("", aws_dynamodb_table.default[*].id) description = "DynamoDB table ID" } output "table_arn" { - value = join("", aws_dynamodb_table.default.*.arn) + value = join("", aws_dynamodb_table.default[*].arn) description = "DynamoDB table ARN" } output "global_secondary_index_names" { - value = null_resource.global_secondary_index_names.*.triggers.name + value = null_resource.global_secondary_index_names[*].triggers.name description = "DynamoDB secondary index names" } output "local_secondary_index_names" { - value = null_resource.local_secondary_index_names.*.triggers.name + value = null_resource.local_secondary_index_names[*].triggers.name description = "DynamoDB local index names" } output "table_stream_arn" { - value = join("", aws_dynamodb_table.default.*.stream_arn) + value = join("", aws_dynamodb_table.default[*].stream_arn) description = "DynamoDB table stream ARN" } output "table_stream_label" { - value = join("", aws_dynamodb_table.default.*.stream_label) + value = join("", aws_dynamodb_table.default[*].stream_label) description = "DynamoDB table stream label" } diff --git a/variables.tf b/variables.tf index f8d114a..ec13485 100644 --- a/variables.tf +++ b/variables.tf @@ -174,3 +174,9 @@ variable "table_class" { default = "STANDARD" description = "DynamoDB storage class of the table. Can be STANDARD or STANDARD_INFREQUENT_ACCESS" } + +variable "deletion_protection_enabled" { + type = bool + default = false + description = "Enable/disable DynamoDB table deletion protection" +} \ No newline at end of file diff --git a/versions.tf b/versions.tf index 9c4b6eb..471bbc5 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.22" + version = ">= 4.59" } null = { source = "hashicorp/null"
name = string
type = string
}))