Skip to content

Commit 5af0660

Browse files
tgc-revival: add google_vpc_access_connector to TGC (#15822)
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent 30f3233 commit 5af0660

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

mmv1/products/vpcaccess/Connector.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
name: 'Connector'
1616
kind: 'vpcaccess#Connector'
1717
description: 'Serverless VPC Access connector resource.'
18+
include_in_tgc_next: true
19+
tgc_include_handwritten_tests: true
1820
references:
1921
guides:
2022
'Configuring Serverless VPC Access': 'https://cloud.google.com/vpc/docs/configure-serverless-vpc-access'
@@ -37,9 +39,11 @@ async:
3739
base_url: '{{op_id}}'
3840
result:
3941
resource_inside_response: true
42+
tgc_ignore_terraform_decoder: true
4043
custom_code:
4144
encoder: 'templates/terraform/encoders/no_send_name.go.tmpl'
4245
decoder: 'templates/terraform/decoders/long_name_to_self_link.go.tmpl'
46+
tgc_decoder: 'templates/tgc_next/decoders/vpc_access_connector_decoder.go.tmpl'
4347
post_create: 'templates/terraform/post_create/sleep.go.tmpl'
4448
constants: 'templates/terraform/constants/vpc_access_connector.go.tmpl'
4549
pre_update: 'templates/terraform/pre_update/vpc_access_connector_instances.go.tmpl'
@@ -77,6 +81,7 @@ properties:
7781
required: true
7882
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl'
7983
immutable: true
84+
tgc_ignore_read: true
8085
- name: 'network'
8186
type: String
8287
description: |
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{{/*
2+
The license inside this block applies to this file
3+
Copyright 2025 Google Inc.
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 http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/ -}}
13+
// When converting from CAI to HCL, both network and subnet may be present in the Asset.
14+
// However, Terraform schema requires exactly one of them.
15+
// We prefer 'subnet' if it's present and valid.
16+
if _, ok := res["subnet"]; ok {
17+
delete(res, "network")
18+
}
19+
20+
// Similarly for instances vs throughput. Prefer instances as throughput is discouraged.
21+
if _, ok := res["minInstances"]; ok {
22+
delete(res, "minThroughput")
23+
}
24+
if _, ok := res["maxInstances"]; ok {
25+
delete(res, "maxThroughput")
26+
}
27+
28+
return res, hclData, nil

0 commit comments

Comments
 (0)