Skip to content

Commit

Permalink
feat(dynamodb): Add support for enabling dynamodb insights
Browse files Browse the repository at this point in the history
  • Loading branch information
rdunn-Hypr committed Oct 30, 2024
1 parent c3ff147 commit 86544a4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions dynamodb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,9 @@ module "dynamodb_autoscaler" {
autoscale_min_write_capacity = var.dynamodb_autoscale_min_write_capacity
autoscale_max_write_capacity = var.dynamodb_autoscale_max_write_capacity
}

resource "aws_dynamodb_contributor_insights" "this" {
count = local.count_dynamodb_insights

table_name = aws_dynamodb_table.this[0].name
}
6 changes: 6 additions & 0 deletions dynamodb_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,9 @@ variable "dynamodb_enable_autoscaler" {
description = "Whether or not to enable DynamoDB autoscaling"
default = false
}

variable "dynamodb_enable_insights" {
type = bool
description = "Enables Contributor Insights for Dynamodb"
default = false
}
1 change: 1 addition & 0 deletions examples/dynamodb_base/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module "example_dynamodb_base" {
dynamodb_autoscale_min_write_capacity = 5
dynamodb_autoscale_max_write_capacity = 20
dynamodb_enable_autoscaler = true
dynamodb_enable_insights = true
}

provider "aws" {
Expand Down
7 changes: 4 additions & 3 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ locals {
create_s3 = var.enable_datastore && var.create_s3_bucket
count_s3 = local.create_s3 ? 1 : 0

create_dynamodb = var.enable_datastore && var.create_dynamodb_table
count_dynamodb = local.create_dynamodb ? 1 : 0

create_dynamodb = var.enable_datastore && var.create_dynamodb_table
create_dynamodb_insights = var.enable_datastore && var.create_dynamodb_table && var.dynamodb_enable_insights
count_dynamodb = local.create_dynamodb ? 1 : 0
count_dynamodb_insights = local.create_dynamodb_insights ? 1 : 0
create_rds_instance = var.enable_datastore && var.create_rds_instance
count_rds_instance = local.create_rds_instance ? 1 : 0

Expand Down

0 comments on commit 86544a4

Please sign in to comment.