-
Notifications
You must be signed in to change notification settings - Fork 270
docs: Add Managed Kafka Connect terraform sample for Clusters #876
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
16d7b2f
docs: Add Managed Kafka Connect terraform sample
salmany 163059e
Update tags in main.tf
salmany 0c1763e
Merge branch 'main' into salman-mkc-code-examples
glasnt dec3c5a
Addressed PR comments.
salmany 0886c4e
Add comment to clarify memory_bytes value.
salmany 315b503
Fix incorrect Kafka cluster reference.
salmany 5e76619
Merge branch 'main' into salman-mkc-code-examples
salmany 612a5ac
Workaround for subnet resource deletion.
salmany 56482a1
Disable tests and update network resource creation
salmany 77d90a5
Merge branch 'main' into salman-mkc-code-examples
glasnt 627f6cb
Fix lint errors.
salmany File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* Copyright 2025 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
# [START managedkafka_create_connect_cluster_parent] | ||
resource "google_managed_kafka_cluster" "default" { | ||
project = data.google_project.default.project_id | ||
cluster_id = "my-cluster-id" | ||
location = "us-central1" | ||
capacity_config { | ||
vcpu_count = 3 | ||
memory_bytes = 3221225472 # 3 GiB | ||
} | ||
gcp_config { | ||
access_config { | ||
network_configs { | ||
subnet = google_compute_subnetwork.default.id | ||
} | ||
} | ||
} | ||
} | ||
|
||
# [START managedkafka_create_connect_cluster] | ||
resource "google_managed_kafka_connect_cluster" "default" { | ||
provider = google-beta | ||
project = data.google_project.default.project_id | ||
connect_cluster_id = "my-connect-cluster-id" | ||
location = "us-central1" | ||
kafka_cluster = google_managed_kafka_cluster.default.id | ||
capacity_config { | ||
vcpu_count = 12 | ||
memory_bytes = 12884901888 # 12 GiB | ||
} | ||
gcp_config { | ||
access_config { | ||
network_configs { | ||
primary_subnet = google_compute_subnetwork.default.id | ||
} | ||
} | ||
} | ||
} | ||
# [END managedkafka_create_connect_cluster] | ||
|
||
# Note: Due to a known issue, network attachment resources may not be | ||
# properly deleted, which can cause 'terraform destroy' to hang. It is | ||
# recommended to destroy network resources separately from the Kafka | ||
# Connect resources. | ||
# The documentation elaborates further on the recommended approach. | ||
# [START managedkafka_subnetwork] | ||
resource "google_compute_subnetwork" "default" { | ||
name = "test-subnetwork" | ||
ip_cidr_range = "10.2.0.0/16" | ||
region = "us-central1" | ||
network = google_compute_network.default.id | ||
} | ||
|
||
resource "google_compute_network" "default" { | ||
name = "test-network" | ||
auto_create_subnetworks = false | ||
} | ||
# [END managedkafka_subnetwork] | ||
|
||
data "google_project" "default" { | ||
} | ||
# [END managedkafka_create_connect_cluster_parent] |
23 changes: 23 additions & 0 deletions
23
managedkafka/managedkafka_create_connect_cluster/test.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2025 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: blueprints.cloud.google.com/v1alpha1 | ||
kind: BlueprintTest | ||
metadata: | ||
name: managedkafka_create_connect_cluster | ||
spec: | ||
# This test is being skipped due to a known issue with leaking Network | ||
# Attachment resources which prevents `terraform destroy` from completing | ||
# successfully in the test environment. | ||
skip: true |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.