Skip to content

Commit

Permalink
Add ability to set PROVISIONED or ON_DEMAND stream modes (closes #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-tr authored and jbeemster committed Dec 6, 2022
1 parent b582f98 commit a7cc7a7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ module "stream" {
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.45.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.71.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.45.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.71.0 |

## Modules

Expand All @@ -48,6 +48,7 @@ No modules.
| <a name="input_retention_period"></a> [retention\_period](#input\_retention\_period) | The number of hours that a shard should retain data for | `number` | `24` | no |
| <a name="input_shard_count"></a> [shard\_count](#input\_shard\_count) | The number of shards to create the stream with | `number` | `1` | no |
| <a name="input_shard_level_metrics"></a> [shard\_level\_metrics](#input\_shard\_level\_metrics) | A list of shard-level CloudWatch metrics which can be enabled for the stream | `list(string)` | `[]` | no |
| <a name="input_stream_mode_details"></a> [stream\_mode\_details](#input\_stream\_mode\_details) | Capacity mode of the stream, either ON\_DEMAND or PROVISIONED (note: ON\_DEMAND comes with a much higher base cost for lower throughput - https://aws.amazon.com/kinesis/data-streams/pricing/) | `string` | `"PROVISIONED"` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | The tags to append to this resource | `map(string)` | `{}` | no |

## Outputs
Expand Down
6 changes: 5 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ locals {

resource "aws_kinesis_stream" "stream" {
name = var.name
shard_count = var.shard_count
shard_count = var.stream_mode_details == "PROVISIONED" ? var.shard_count : null
retention_period = var.retention_period
encryption_type = var.encryption_type
kms_key_id = var.kms_key_id
Expand All @@ -21,4 +21,8 @@ resource "aws_kinesis_stream" "stream" {
shard_level_metrics = var.shard_level_metrics

tags = local.tags

stream_mode_details {
stream_mode = var.stream_mode_details
}
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ variable "tags" {
default = {}
type = map(string)
}

variable "stream_mode_details" {
description = "Capacity mode of the stream, either ON_DEMAND or PROVISIONED (note: ON_DEMAND comes with a much higher base cost for lower throughput - https://aws.amazon.com/kinesis/data-streams/pricing/)"
default = "PROVISIONED"
type = string
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.45.0"
version = ">= 3.71.0"
}
}
}

0 comments on commit a7cc7a7

Please sign in to comment.