From 28c4143e15c2111d6716b10d41f241a9ae24da9b Mon Sep 17 00:00:00 2001 From: martin-nhs Date: Fri, 1 Dec 2023 11:30:32 +0000 Subject: [PATCH] [PRMT-4252-DYNAMODB] Added `deletion_protection_enabled = true` and `point_in_time_recovery` enabled to both `{env}-repo-mhs-state` and `{env}-repo-mhs-sync-async-state`. --- terraform/dynamodb.tf | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/terraform/dynamodb.tf b/terraform/dynamodb.tf index 725c1bf..768b90e 100644 --- a/terraform/dynamodb.tf +++ b/terraform/dynamodb.tf @@ -1,9 +1,14 @@ # The MHS DynamoDB state table, for storing state for each message handled resource "aws_dynamodb_table" "mhs_state_table" { - name = "${var.environment}-${var.cluster_name}-mhs-state" - hash_key = "key" - read_capacity = var.mhs_state_table_read_capacity - write_capacity = var.mhs_state_table_write_capacity + name = "${var.environment}-${var.cluster_name}-mhs-state" + hash_key = "key" + read_capacity = var.mhs_state_table_read_capacity + write_capacity = var.mhs_state_table_write_capacity + deletion_protection_enabled = true + + point_in_time_recovery { + enabled = true + } attribute { name = "key" @@ -11,18 +16,23 @@ resource "aws_dynamodb_table" "mhs_state_table" { } tags = { - Name = "${var.environment}-${var.cluster_name}-mhs-state-table" + Name = "${var.environment}-${var.cluster_name}-mhs-state-table" Environment = var.environment - CreatedBy = var.repo_name + CreatedBy = var.repo_name } } # The MHS DynamoDB sync-async table, used as a queue for the sync-async workflow resource "aws_dynamodb_table" "mhs_sync_async_table" { - name = "${var.environment}-${var.cluster_name}-mhs-sync-async-state" - hash_key = "key" - read_capacity = var.mhs_sync_async_table_read_capacity - write_capacity = var.mhs_sync_async_table_write_capacity + name = "${var.environment}-${var.cluster_name}-mhs-sync-async-state" + hash_key = "key" + read_capacity = var.mhs_sync_async_table_read_capacity + write_capacity = var.mhs_sync_async_table_write_capacity + deletion_protection_enabled = true + + point_in_time_recovery { + enabled = true + } attribute { name = "key" @@ -30,8 +40,8 @@ resource "aws_dynamodb_table" "mhs_sync_async_table" { } tags = { - Name = "${var.environment}-${var.cluster_name}-mhs-sync-async-table" + Name = "${var.environment}-${var.cluster_name}-mhs-sync-async-table" Environment = var.environment - CreatedBy = var.repo_name + CreatedBy = var.repo_name } } \ No newline at end of file