Skip to content

Commit

Permalink
Add option to enable point in time recovery for DynamoDB tables (#35)
Browse files Browse the repository at this point in the history
* Add option to enable point in time recovery for DynamoDB tables

* Updated README.md

* Update variables.tf

Co-Authored-By: Andriy Knysh <aknysh@users.noreply.github.com>

* Updated README.md

Co-authored-by: Maxim Mironenko <simixido@gmail.com>
Co-authored-by: actions-bot <58130806+actions-bot@users.noreply.github.com>
Co-authored-by: Andriy Knysh <aknysh@users.noreply.github.com>
  • Loading branch information
4 people authored Feb 19, 2020
1 parent 6c3353f commit d28ccb2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ Available targets:
| block_public_policy | Whether Amazon S3 should block public bucket policies for this bucket | string | `true` | no |
| context | Default context to use for passing state between label invocations | object | `<map>` | no |
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
| enable_point_in_time_recovery | Enable DynamoDB point-in-time recovery | bool | `false` | no |
| enable_server_side_encryption | Enable DynamoDB server-side encryption | bool | `true` | no |
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
| force_destroy | A boolean that indicates the S3 bucket can be destroyed even if it contains objects. These objects are not recoverable | bool | `false` | no |
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| block_public_policy | Whether Amazon S3 should block public bucket policies for this bucket | string | `true` | no |
| context | Default context to use for passing state between label invocations | object | `<map>` | no |
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
| enable_point_in_time_recovery | Enable DynamoDB point-in-time recovery | bool | `false` | no |
| enable_server_side_encryption | Enable DynamoDB server-side encryption | bool | `true` | no |
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
| force_destroy | A boolean that indicates the S3 bucket can be destroyed even if it contains objects. These objects are not recoverable | bool | `false` | no |
Expand Down
8 changes: 8 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ resource "aws_dynamodb_table" "with_server_side_encryption" {
enabled = true
}

point_in_time_recovery {
enabled = var.enable_point_in_time_recovery
}

lifecycle {
ignore_changes = [
read_capacity,
Expand All @@ -167,6 +171,10 @@ resource "aws_dynamodb_table" "without_server_side_encryption" {
# https://www.terraform.io/docs/backends/types/s3.html#dynamodb_table
hash_key = "LockID"

point_in_time_recovery {
enabled = var.enable_point_in_time_recovery
}

lifecycle {
ignore_changes = [
read_capacity,
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ variable "mfa_delete" {
default = false
}

variable "enable_point_in_time_recovery" {
type = bool
description = "Enable DynamoDB point-in-time recovery"
default = false
}

variable "enable_server_side_encryption" {
type = bool
description = "Enable DynamoDB server-side encryption"
Expand Down

0 comments on commit d28ccb2

Please sign in to comment.