Skip to content

Commit 5451158

Browse files
shmickaknysh
authored andcommitted
add billing_mode support (#31)
1 parent f21f7b9 commit 5451158

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ Available targets:
159159
| autoscale_min_write_capacity | DynamoDB autoscaling min write capacity | string | `5` | no |
160160
| autoscale_read_target | The target value (in %) for DynamoDB read autoscaling | string | `50` | no |
161161
| autoscale_write_target | The target value (in %) for DynamoDB write autoscaling | string | `50` | no |
162+
| billing_mode | DynamoDB Billing mode. Can be PROVISIONED or PAY_PER_REQUEST | string | `PROVISIONED` | no |
162163
| delimiter | Delimiter to be used between `namespace`, `stage`, `name`, and `attributes` | string | `-` | no |
163164
| dynamodb_attributes | Additional DynamoDB attributes in the form of a list of mapped values | list | `<list>` | no |
164165
| enable_autoscaler | Flag to enable/disable DynamoDB autoscaling | string | `true` | no |

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
| autoscale_min_write_capacity | DynamoDB autoscaling min write capacity | string | `5` | no |
1010
| autoscale_read_target | The target value (in %) for DynamoDB read autoscaling | string | `50` | no |
1111
| autoscale_write_target | The target value (in %) for DynamoDB write autoscaling | string | `50` | no |
12+
| billing_mode | DynamoDB Billing mode. Can be PROVISIONED or PAY_PER_REQUEST | string | `PROVISIONED` | no |
1213
| delimiter | Delimiter to be used between `namespace`, `stage`, `name`, and `attributes` | string | `-` | no |
1314
| dynamodb_attributes | Additional DynamoDB attributes in the form of a list of mapped values | list | `<list>` | no |
1415
| enable_autoscaler | Flag to enable/disable DynamoDB autoscaling | string | `true` | no |

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ resource "null_resource" "local_secondary_index_names" {
4949
resource "aws_dynamodb_table" "default" {
5050
count = "${var.enabled == "true" ? 1 : 0 }"
5151
name = "${module.dynamodb_label.id}"
52+
billing_mode = "${var.billing_mode}"
5253
read_capacity = "${var.autoscale_min_read_capacity}"
5354
write_capacity = "${var.autoscale_min_write_capacity}"
5455
hash_key = "${var.hash_key}"
@@ -82,7 +83,7 @@ resource "aws_dynamodb_table" "default" {
8283

8384
module "dynamodb_autoscaler" {
8485
source = "git::https://github.com/cloudposse/terraform-aws-dynamodb-autoscaler.git?ref=tags/0.2.5"
85-
enabled = "${var.enabled == "true" && var.enable_autoscaler == "true"}"
86+
enabled = "${var.enabled == "true" && var.enable_autoscaler == "true" && var.billing_mode == "PROVISIONED"}"
8687
namespace = "${var.namespace}"
8788
stage = "${var.stage}"
8889
name = "${var.name}"

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ variable "autoscale_max_write_capacity" {
6666
description = "DynamoDB autoscaling max write capacity"
6767
}
6868

69+
variable "billing_mode" {
70+
type = "string"
71+
default = "PROVISIONED"
72+
description = "DynamoDB Billing mode. Can be PROVISIONED or PAY_PER_REQUEST"
73+
}
74+
6975
variable "enable_streams" {
7076
type = "string"
7177
default = "false"

0 commit comments

Comments
 (0)