Skip to content

Commit 56482a1

Browse files
committed
Disable tests and update network resource creation
1 parent 612a5ac commit 56482a1

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-20
lines changed

managedkafka/managedkafka_create_connect_cluster/main.tf

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,17 @@ resource "google_managed_kafka_connect_cluster" "default" {
5353
}
5454
# [END managedkafka_create_connect_cluster]
5555

56+
# Note: Due to a known issue, network attachment resources may not be
57+
# properly deleted, which can cause 'terraform destroy' to hang. It is
58+
# recommended to destroy network resources separately from the Kafka
59+
# Connect resources.
60+
# The documentation elaborates further on the recommended approach.
5661
# [START managedkafka_subnetwork]
5762
resource "google_compute_subnetwork" "default" {
5863
name = "test-subnetwork"
5964
ip_cidr_range = "10.2.0.0/16"
6065
region = "us-central1"
6166
network = google_compute_network.default.id
62-
63-
provisioner "local-exec" {
64-
when = destroy
65-
command = <<-EOT
66-
set -e
67-
gcloud compute network-attachments list \
68-
--filter="subnetworks:https://www.googleapis.com/compute/v1/${self.id}" \
69-
--format="value(name)" --project="${self.project}" |
70-
while read -r na_name; do
71-
[[ -z "$na_name" ]] && continue
72-
for i in {1..5}; do
73-
gcloud compute network-attachments delete "$na_name" \
74-
--project="${self.project}" --region="${self.region}" --quiet && break
75-
if [[ $i -eq 5 ]]; then exit 1; fi
76-
sleep 30
77-
done
78-
done
79-
EOT
80-
interpreter = ["bash", "-c"]
81-
}
8267
}
8368

8469
resource "google_compute_network" "default" {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: blueprints.cloud.google.com/v1alpha1
16+
kind: BlueprintTest
17+
metadata:
18+
name: managedkafka_create_connect_cluster
19+
spec:
20+
# This test is being skipped due to a known issue with leaking Network
21+
# Attachment resources which prevents `terraform destroy` from completing
22+
# successfully in the test environment.
23+
skip: true

0 commit comments

Comments
 (0)