Skip to content

Commit 34292bd

Browse files
committed
Disable tests and modify subnet resources.
1 parent 79d5fc0 commit 34292bd

File tree

10 files changed

+144
-104
lines changed

10 files changed

+144
-104
lines changed

managedkafka/managedkafka_create_connector_bigquery_sink/main.tf

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,32 +52,17 @@ resource "google_managed_kafka_connect_cluster" "default" {
5252
}
5353
}
5454

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

8368
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_connector_bigquery_sink
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

managedkafka/managedkafka_create_connector_cloud_storage_sink/main.tf

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,32 +52,17 @@ resource "google_managed_kafka_connect_cluster" "default" {
5252
}
5353
}
5454

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

8368
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_connector_cloud_storage_sink
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

managedkafka/managedkafka_create_connector_mirrormaker/main.tf renamed to managedkafka/managedkafka_create_connector_mirrormaker_source/main.tf

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
# [START managedkafka_create_connector_mirrormaker_parent]
17+
# [START managedkafka_create_connector_mirrormaker_source_parent]
1818

1919
resource "google_managed_kafka_cluster" "default" {
2020
project = data.google_project.default.project_id
@@ -52,32 +52,17 @@ resource "google_managed_kafka_connect_cluster" "default" {
5252
}
5353
}
5454

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

8368
resource "google_compute_network" "default" {
@@ -86,7 +71,7 @@ resource "google_compute_network" "default" {
8671
}
8772
# [END managedkafka_subnetwork]
8873

89-
# [START managedkafka_create_connector_mirrormaker]
74+
# [START managedkafka_create_connector_mirrormaker_source]
9075
resource "google_managed_kafka_connector" "default" {
9176
project = data.google_project.default.project_id
9277
connector_id = "MM2_CONNECTOR_ID"
@@ -114,9 +99,9 @@ resource "google_managed_kafka_connector" "default" {
11499

115100
provider = google-beta
116101
}
117-
# [END managedkafka_create_connector_mirrormaker]
102+
# [END managedkafka_create_connector_mirrormaker_source]
118103

119104
data "google_project" "default" {
120105
}
121106

122-
# [END managedkafka_create_connector_mirrormaker_parent]
107+
# [END managedkafka_create_connector_mirrormaker_source_parent]
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_connector_mirrormaker_source
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

managedkafka/managedkafka_create_connector_pubsub_sink/main.tf

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,32 +52,17 @@ resource "google_managed_kafka_connect_cluster" "default" {
5252
}
5353
}
5454

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

8368
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_connector_pubsub_sink
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

managedkafka/managedkafka_create_connector_pubsub_source/main.tf

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,32 +52,17 @@ resource "google_managed_kafka_connect_cluster" "default" {
5252
}
5353
}
5454

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

8368
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_pubsub_source
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)