Skip to content

Commit d480235

Browse files
runV2: add support for value "connector" on field "vpcAccess" on resource "google_cloudrunv2_worker_pool" (#15108)
1 parent 19190d8 commit d480235

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

mmv1/products/cloudrunv2/WorkerPool.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,10 @@ properties:
332332
description: |-
333333
VPC Access configuration to use for this Revision. For more information, visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
334334
properties:
335+
- name: 'connector'
336+
type: String
337+
description: |-
338+
VPC Access connector name. Format: projects/{project}/locations/{location}/connectors/{connector}, where {project} can be project id or number.
335339
- name: 'egress'
336340
type: Enum
337341
description: |-

mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.tmpl

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,78 @@ import (
1313
"github.com/hashicorp/terraform-provider-google/google/services/cloudrunv2"
1414
)
1515

16+
func TestAccCloudRunV2WorkerPool_vpcAccess_basic(t *testing.T) {
17+
t.Parallel()
18+
19+
ctx := map[string]interface{}{
20+
"rs": acctest.RandString(t, 10),
21+
"region": "us-central1",
22+
}
23+
24+
acctest.VcrTest(t, resource.TestCase{
25+
PreCheck: func() { acctest.AccTestPreCheck(t) },
26+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
27+
CheckDestroy: testAccCheckCloudRunV2WorkerPoolDestroyProducer(t),
28+
Steps: []resource.TestStep{
29+
{
30+
Config: testAccCloudRunV2WorkerPool_vpcAccess_basicConfig(ctx),
31+
},
32+
{
33+
ResourceName: "google_cloud_run_v2_worker_pool.primary",
34+
ImportState: true,
35+
ImportStateVerify: true,
36+
ImportStateVerifyIgnore: []string{
37+
"name", "location", "annotations", "labels", "terraform_labels",
38+
"deletion_protection",
39+
},
40+
},
41+
},
42+
})
43+
}
44+
45+
func testAccCloudRunV2WorkerPool_vpcAccess_basicConfig(ctx map[string]interface{}) string {
46+
return fmt.Sprintf(`
47+
resource "google_compute_network" "primary" {
48+
name = "tf-crwp-vpc-%[1]s"
49+
auto_create_subnetworks = false
50+
}
51+
52+
resource "google_compute_subnetwork" "primary" {
53+
name = "tf-crwp-subnet-%[1]s"
54+
ip_cidr_range = "10.0.0.0/16"
55+
region = "%[2]s"
56+
network = google_compute_network.primary.id
57+
}
58+
59+
resource "google_vpc_access_connector" "primary" {
60+
name = "tf-crwp-conn-%[1]s"
61+
region = "%[2]s"
62+
network = google_compute_network.primary.name
63+
ip_cidr_range = "10.8.0.0/28"
64+
65+
# Exigência atual da API: definir capacidade explícita
66+
min_instances = 2
67+
max_instances = 3
68+
}
69+
70+
resource "google_cloud_run_v2_worker_pool" "primary" {
71+
name = "tf-crwp-%[1]s"
72+
location = "%[2]s"
73+
deletion_protection = false
74+
launch_stage = "BETA"
75+
76+
template {
77+
containers {
78+
image = "gcr.io/cloudrun/hello"
79+
}
80+
vpc_access {
81+
connector = google_vpc_access_connector.primary.id
82+
}
83+
}
84+
}
85+
`, ctx["rs"], ctx["region"])
86+
}
87+
1688
func TestAccCloudRunV2Service_cloudrunv2ServiceFullUpdate(t *testing.T) {
1789
t.Parallel()
1890

0 commit comments

Comments
 (0)