Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic topic config for energy-budget-plan namespace #164

Merged
merged 9 commits into from
Feb 29, 2024
Merged
1 change: 1 addition & 0 deletions dev-aws/kafka-shared-msk/energy-budget-plan/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../../lib/kafka-shared/Makefile
17 changes: 17 additions & 0 deletions dev-aws/kafka-shared-msk/energy-budget-plan/__env.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
terraform {
backend "s3" {}

required_providers {
kafka = {
source = "Mongey/kafka"
}
}
}

provider "kafka" {
bootstrap_servers = [
"b-1.devenablementpubsubmsk.xmhf7r.c8.kafka.eu-west-1.amazonaws.com:9094",
"b-2.devenablementpubsubmsk.xmhf7r.c8.kafka.eu-west-1.amazonaws.com:9094",
"b-3.devenablementpubsubmsk.xmhf7r.c8.kafka.eu-west-1.amazonaws.com:9094",
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
resource "kafka_topic" "eqdb_loader" {
name = "energy-budget-plan.eqdb-loader"
replication_factor = 3
partitions = 1
config = {
# retain 100MB on each partition
"retention.bytes" = "104857600"
# keep data for 18 hours
"retention.ms" = "64800000"
# allow max 1 MB for a message
"max.message.bytes" = "1048576"
"compression.type" = "zstd"
"cleanup.policy" = "delete"
}
}

resource "kafka_topic" "budget_plan" {
name = "energy-budget-plan.budget-plan"
replication_factor = 3
partitions = 10
config = {
# Use tiered storage
"remote.storage.enable" = "true"
# keep data for 7 years
"retention.ms" = "220898482000"
# keep data in hot storage for 2 days
"local.retention.ms" = "172800000"
# allow max 1 MB for a message
"max.message.bytes" = "1048576"
"compression.type" = "zstd"
"cleanup.policy" = "delete"
}
}

resource "kafka_topic" "customer_change" {
name = "energy-budget-plan.customer-change"
replication_factor = 3
partitions = 10
config = {
# Use tiered storage
"remote.storage.enable" = "true"
# keep data for 2 years
"retention.ms" = "63113852000"
# keep data in hot storage for 7 days
"local.retention.ms" = "604800000"
# allow max 1 MB for a message
"max.message.bytes" = "1048576"
"compression.type" = "zstd"
"cleanup.policy" = "delete"
}
}

module "eqdb_loader_process" {
source = "../../../modules/tls-app"
produce_topics = [kafka_topic.eqdb_loader.name]
cert_common_name = "energy-budget-plan/eqdb-loader"
}

module "budget_plan_fabricator" {
source = "../../../modules/tls-app"
consume_topics = { (kafka_topic.eqdb_loader.name) : "energy-budget-plan.eqdb-fabricator-loader-v1", (kafka_topic.customer_change.name) : "energy-budget-plan.eqdb-fabricator-customer-change-v1" }
produce_topics = [kafka_topic.customer_change.name]
cert_common_name = "energy-budget-plan/eqdb-fabricator"
}

module "budget_plan_calculator" {
source = "../../../modules/tls-app"
consume_topics = { (kafka_topic.budget_plan.name) : "energy-budget-plan.calculator-v1" }
produce_topics = [kafka_topic.budget_plan.name]
cert_common_name = "energy-budget-plan/calculator"
}
Loading