Skip to content

Commit

Permalink
Don't set read/write capacity in PAY_PER_REQUEST billing mode
Browse files Browse the repository at this point in the history
This causes errors at plan-time now:

Error: 2 errors occurred:
	* read_capacity can not be set when billing_mode is "PAY_PER_REQUEST"
	* write_capacity can not be set when billing_mode is "PAY_PER_REQUEST"

  with module.dynamodb_table.aws_dynamodb_table.default[0],
  on .terraform/modules/dynamodb_table/main.tf line 46, in resource "aws_dynamodb_table" "default":
  46: resource "aws_dynamodb_table" "default" {
  • Loading branch information
alexjurkiewicz committed Jan 26, 2022
1 parent e605469 commit a3597eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ resource "aws_dynamodb_table" "default" {
count = local.enabled ? 1 : 0
name = module.this.id
billing_mode = var.billing_mode
read_capacity = var.autoscale_min_read_capacity
write_capacity = var.autoscale_min_write_capacity
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
Expand Down

0 comments on commit a3597eb

Please sign in to comment.