Skip to content

Commit

Permalink
Revert recent dynamodb changes (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
danjbh authored Sep 17, 2020
1 parent cf7c482 commit bacd68a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 11 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ Available targets:
| block\_public\_policy | Whether Amazon S3 should block public bucket policies for this bucket | `bool` | `true` | no |
| context | Default context to use for passing state between label invocations | <pre>object({<br> namespace = string<br> environment = string<br> stage = string<br> name = string<br> enabled = bool<br> delimiter = string<br> attributes = list(string)<br> label_order = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> })</pre> | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": "",<br> "enabled": true,<br> "environment": "",<br> "label_order": [],<br> "name": "",<br> "namespace": "",<br> "regex_replace_chars": "",<br> "stage": "",<br> "tags": {}<br>}</pre> | no |
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | `string` | `"-"` | no |
| enable\_dynamodb | Enable DynamoDB Locking | `bool` | `true` | no |
| enable\_point\_in\_time\_recovery | Enable DynamoDB point-in-time recovery | `bool` | `false` | no |
| enable\_public\_access\_block | Enable Bucket Public Access Block | `bool` | `true` | no |
| enable\_server\_side\_encryption | Enable DynamoDB server-side encryption | `bool` | `true` | no |
Expand Down
1 change: 0 additions & 1 deletion docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
| block\_public\_policy | Whether Amazon S3 should block public bucket policies for this bucket | `bool` | `true` | no |
| context | Default context to use for passing state between label invocations | <pre>object({<br> namespace = string<br> environment = string<br> stage = string<br> name = string<br> enabled = bool<br> delimiter = string<br> attributes = list(string)<br> label_order = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> })</pre> | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": "",<br> "enabled": true,<br> "environment": "",<br> "label_order": [],<br> "name": "",<br> "namespace": "",<br> "regex_replace_chars": "",<br> "stage": "",<br> "tags": {}<br>}</pre> | no |
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | `string` | `"-"` | no |
| enable\_dynamodb | Enable DynamoDB Locking | `bool` | `true` | no |
| enable\_point\_in\_time\_recovery | Enable DynamoDB point-in-time recovery | `bool` | `false` | no |
| enable\_public\_access\_block | Enable Bucket Public Access Block | `bool` | `true` | no |
| enable\_server\_side\_encryption | Enable DynamoDB server-side encryption | `bool` | `true` | no |
Expand Down
5 changes: 2 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,12 @@ resource "aws_s3_bucket_public_access_block" "default" {

module "dynamodb_table_label" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.17.0"
enabled = var.enable_dynamodb
context = module.base_label.context
attributes = compact(concat(var.attributes, ["lock"]))
}

resource "aws_dynamodb_table" "with_server_side_encryption" {
count = var.enable_dynamodb && var.enable_server_side_encryption ? 1 : 0
count = var.enable_server_side_encryption ? 1 : 0
name = module.dynamodb_table_label.id
billing_mode = var.billing_mode
read_capacity = var.billing_mode == "PROVISIONED" ? var.read_capacity : null
Expand Down Expand Up @@ -213,7 +212,7 @@ resource "aws_dynamodb_table" "with_server_side_encryption" {
}

resource "aws_dynamodb_table" "without_server_side_encryption" {
count = var.enable_dynamodb || var.enable_server_side_encryption ? 0 : 1
count = var.enable_server_side_encryption ? 0 : 1
name = module.dynamodb_table_label.id
billing_mode = var.billing_mode
read_capacity = var.billing_mode == "PROVISIONED" ? var.read_capacity : null
Expand Down
6 changes: 0 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ variable "enable_public_access_block" {
default = true
}

variable "enable_dynamodb" {
type = bool
description = "Enable DynamoDB Locking"
default = true
}

variable "block_public_acls" {
type = bool
description = "Whether Amazon S3 should block public ACLs for this bucket"
Expand Down

0 comments on commit bacd68a

Please sign in to comment.