Skip to content

Commit 3e02bdd

Browse files
authored
tgc_revival: add tgc compute node and route (#15974)
1 parent 4a681fa commit 3e02bdd

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed

mmv1/products/compute/NodeTemplate.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ async:
3939
resource_inside_response: false
4040
collection_url_key: 'items'
4141
custom_code:
42+
include_in_tgc_next: true
43+
tgc_include_handwritten_tests: true
4244
examples:
4345
- name: 'node_template_basic'
4446
primary_resource_id: 'template'

mmv1/products/compute/ResourcePolicy.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ async:
3838
collection_url_key: 'items'
3939
custom_code:
4040
constants: 'templates/terraform/constants/compute_resource_policy.go.tmpl'
41+
include_in_tgc_next: true
42+
tgc_include_handwritten_tests: true
4143
sweeper:
4244
url_substitutions:
4345
- region: "us-central1"

mmv1/products/compute/Route.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,12 @@ custom_code:
6868
extra_schema_entry: 'templates/terraform/extra_schema_entry/route.tmpl'
6969
constants: 'templates/terraform/constants/compute_route.go.tmpl'
7070
decoder: 'templates/terraform/decoders/route.tmpl'
71+
tgc_decoder: 'templates/tgc_next/decoders/compute_route.tmpl'
7172
error_retry_predicates:
7273

7374
- 'transport_tpg.IsPeeringOperationInProgress'
75+
include_in_tgc_next: true
76+
tgc_include_handwritten_tests: true
7477
examples:
7578
- name: 'route_basic'
7679
primary_resource_id: 'default'
@@ -188,6 +191,7 @@ properties:
188191
- 'next_hop_vpn_tunnel'
189192
- 'next_hop_ilb'
190193
custom_expand: 'templates/terraform/custom_expand/route_instance.tmpl'
194+
custom_tgc_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl'
191195
resource: 'Instance'
192196
imports: 'selfLink'
193197
- name: 'nextHopIp'

mmv1/products/compute/Router.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ custom_code:
4444
constants: 'templates/terraform/constants/router.go.tmpl'
4545
custom_diff:
4646
- 'resourceComputeRouterCustomDiff'
47+
include_in_tgc_next: true
48+
tgc_include_handwritten_tests: true
4749
sweeper:
4850
prefixes:
4951
- "swg-autogen-router" # Secure Web Proxy(SWP) auto-generated router prefix.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
if v, ok := res["nextHopInstance"]; ok {
2+
val, err := tpgresource.ParseZonalFieldValue("instances", v.(string), "project", "next_hop_instance_zone", d, meta.(*transport_tpg.Config), true)
3+
if err != nil {
4+
return nil, nil, err
5+
}
6+
hclData["next_hop_instance_zone"] = val.Zone
7+
res["nextHopInstance"] = val.RelativeLink()
8+
}
9+
10+
// next_hop_ip is Computed + Optional and conflict with next_hop_ilb
11+
if _, ok := res["nextHopIp"]; ok {
12+
if _, ok := res["nextHopIlb"]; ok {
13+
delete(res, "nextHopIp")
14+
}
15+
}
16+
17+
return res, hclData, nil

0 commit comments

Comments
 (0)