Skip to content

Commit 16d7b2f

Browse files
committed
docs: Add Managed Kafka Connect terraform sample
for Clusters * Add sample code for creating a Kafka Connect cluster
1 parent a523e38 commit 16d7b2f

File tree

1 file changed

+59
-0
lines changed
  • managedkafka/managedkafka_create_connect_cluster

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
# [START managedkafkaconnect_create_cluster_parent]
18+
resource "google_managed_kafka_cluster" "example-kafka-cluster" {
19+
project = data.google_project.default.project_id
20+
cluster_id = "my-cluster-id"
21+
location = "us-central1"
22+
capacity_config {
23+
vcpu_count = 3
24+
memory_bytes = 3221225472
25+
}
26+
gcp_config {
27+
access_config {
28+
network_configs {
29+
subnet = "projects/${data.google_project.default.number}/regions/us-central1/subnetworks/default"
30+
}
31+
}
32+
}
33+
}
34+
35+
# [START managedkafkaconnect_create_cluster]
36+
resource "google_managed_kafka_connect_cluster" "example-kafka-connect-cluster" {
37+
provider = google-beta
38+
project = data.google_project.default.project_id # Replace this with your project ID in quotes
39+
connect_cluster_id = "my-connect-cluster-id"
40+
location = "us-central1"
41+
kafka_cluster = google_managed_kafka_cluster.example-kafka-cluster.id # Replace this with the ID of the primary Managed Service for Apache Kafka cluster associated with your Connect cluster in quotes
42+
capacity_config {
43+
vcpu_count = 3
44+
memory_bytes = 3221225472
45+
}
46+
gcp_config {
47+
access_config {
48+
network_configs {
49+
primary_subnet = "projects/${data.google_project.default.number}/regions/us-central1/subnetworks/default"
50+
}
51+
}
52+
}
53+
}
54+
# [END managedkafkaconnect_create_cluster]
55+
56+
data "google_project" "default" {
57+
provider = google-beta
58+
}
59+
# [END managedkafkaconnect_create_cluster_parent]

0 commit comments

Comments
 (0)