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
42+ capacity_config {
43+ vcpu_count = 12
44+ memory_bytes = 21474836480
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+ depends_on = [
54+ google_managed_kafka_cluster . example-kafka-cluster
55+ ]
56+ }
57+ # [END managedkafkaconnect_create_cluster]
58+
59+ data "google_project" "default" {
60+ provider = google- beta
61+ }
62+ # [END managedkafkaconnect_create_cluster_parent]
0 commit comments