Skip to content

Commit 4d11d5f

Browse files
feat: Kafka cluster
1 parent 22102e8 commit 4d11d5f

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ module "gke" {
6868
depends_on = [module.networking]
6969
}
7070

71+
module "kafka" {
72+
source = "./modules/kafka"
73+
namespace = var.namespace
74+
75+
depends_on = [module.networking]
76+
77+
subnetwork_self_link = module.networking.subnetwork.self_link
78+
}
79+
7180
module "service_accounts" {
7281
source = "./modules/service_accounts"
7382
namespace = var.namespace

modules/kafka/main.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
resource "google_managed_kafka_cluster" "this" {
2+
project = data.google_client_config.current.project
3+
cluster_id = "${var.namespace}-kafka-cluster"
4+
location = data.google_client_config.current.region
5+
6+
capacity_config {
7+
vcpu_count = 3
8+
memory_bytes = 32 * 1024 * 1024 * 1024
9+
}
10+
11+
gcp_config {
12+
access_config {
13+
network_configs {
14+
subnet = var.subnetwork_self_link.name
15+
}
16+
}
17+
}
18+
}

modules/kafka/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
variable "namespace" {
2+
type = string
3+
description = "The name prefix for all resources created."
4+
}
5+
6+
variable "subnetwork_self_link" {
7+
description = "The subnetwork self link."
8+
type = string
9+
}

0 commit comments

Comments
 (0)