Skip to content

Commit 75dde0a

Browse files
Update Network Connectivity Spoke Router and VPN Tunnels (#12519) (#8883)
[upstream:3a54268c0efd6991b9d9763d63742619b8787e9e] Signed-off-by: Modular Magician <[email protected]>
1 parent e7e8cdb commit 75dde0a

File tree

4 files changed

+614
-23
lines changed

4 files changed

+614
-23
lines changed

.changelog/12519.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```release-note:enhancement
2+
networkconnectivity: added support for updating `linked_vpn_tunnels.include_import_ranges`, `linked_interconnect_attachments.include_import_ranges`, `linked_router_appliance_instances. instances` and `linked_router_appliance_instances.include_import_ranges` in `google_network_connectivity_spoke`
3+
```
4+
```release-note:bug
5+
networkconnectivity: fixed `linked_router_appliance_instances.instances.virtual_machine` and `linked_router_appliance_instances.instances.ip_address` attributes in `google_network_connectivity_spoke` to be correctly marked as required. Otherwise the request to create the resource will fail.
6+
```

google-beta/services/networkconnectivity/resource_network_connectivity_spoke.go

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ Please refer to the field 'effective_labels' for all of the labels present on th
9292
"linked_interconnect_attachments": {
9393
Type: schema.TypeList,
9494
Optional: true,
95-
ForceNew: true,
9695
Description: `A collection of VLAN attachment resources. These resources should be redundant attachments that all advertise the same prefixes to Google Cloud. Alternatively, in active/passive configurations, all attachments should be capable of advertising the same prefixes.`,
9796
MaxItems: 1,
9897
Elem: &schema.Resource{
@@ -176,7 +175,6 @@ The only allowed value for now is "ALL_IPV4_RANGES".`,
176175
"linked_router_appliance_instances": {
177176
Type: schema.TypeList,
178177
Optional: true,
179-
ForceNew: true,
180178
Description: `The URIs of linked Router appliance resources`,
181179
MaxItems: 1,
182180
Elem: &schema.Resource{
@@ -190,13 +188,13 @@ The only allowed value for now is "ALL_IPV4_RANGES".`,
190188
Schema: map[string]*schema.Schema{
191189
"ip_address": {
192190
Type: schema.TypeString,
193-
Optional: true,
191+
Required: true,
194192
ForceNew: true,
195193
Description: `The IP address on the VM to use for peering.`,
196194
},
197195
"virtual_machine": {
198196
Type: schema.TypeString,
199-
Optional: true,
197+
Required: true,
200198
ForceNew: true,
201199
DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName,
202200
Description: `The URI of the virtual machine resource`,
@@ -263,7 +261,6 @@ The only allowed value for now is "ALL_IPV4_RANGES".`,
263261
"linked_vpn_tunnels": {
264262
Type: schema.TypeList,
265263
Optional: true,
266-
ForceNew: true,
267264
Description: `The URIs of linked VPN tunnel resources`,
268265
MaxItems: 1,
269266
Elem: &schema.Resource{
@@ -573,6 +570,24 @@ func resourceNetworkConnectivitySpokeUpdate(d *schema.ResourceData, meta interfa
573570
} else if v, ok := d.GetOkExists("description"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
574571
obj["description"] = descriptionProp
575572
}
573+
linkedVpnTunnelsProp, err := expandNetworkConnectivitySpokeLinkedVpnTunnels(d.Get("linked_vpn_tunnels"), d, config)
574+
if err != nil {
575+
return err
576+
} else if v, ok := d.GetOkExists("linked_vpn_tunnels"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, linkedVpnTunnelsProp)) {
577+
obj["linkedVpnTunnels"] = linkedVpnTunnelsProp
578+
}
579+
linkedInterconnectAttachmentsProp, err := expandNetworkConnectivitySpokeLinkedInterconnectAttachments(d.Get("linked_interconnect_attachments"), d, config)
580+
if err != nil {
581+
return err
582+
} else if v, ok := d.GetOkExists("linked_interconnect_attachments"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, linkedInterconnectAttachmentsProp)) {
583+
obj["linkedInterconnectAttachments"] = linkedInterconnectAttachmentsProp
584+
}
585+
linkedRouterApplianceInstancesProp, err := expandNetworkConnectivitySpokeLinkedRouterApplianceInstances(d.Get("linked_router_appliance_instances"), d, config)
586+
if err != nil {
587+
return err
588+
} else if v, ok := d.GetOkExists("linked_router_appliance_instances"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, linkedRouterApplianceInstancesProp)) {
589+
obj["linkedRouterApplianceInstances"] = linkedRouterApplianceInstancesProp
590+
}
576591
labelsProp, err := expandNetworkConnectivitySpokeEffectiveLabels(d.Get("effective_labels"), d, config)
577592
if err != nil {
578593
return err
@@ -593,6 +608,19 @@ func resourceNetworkConnectivitySpokeUpdate(d *schema.ResourceData, meta interfa
593608
updateMask = append(updateMask, "description")
594609
}
595610

611+
if d.HasChange("linked_vpn_tunnels") {
612+
updateMask = append(updateMask, "linkedVpnTunnels.includeImportRanges")
613+
}
614+
615+
if d.HasChange("linked_interconnect_attachments") {
616+
updateMask = append(updateMask, "linkedInterconnectAttachments.includeImportRanges")
617+
}
618+
619+
if d.HasChange("linked_router_appliance_instances") {
620+
updateMask = append(updateMask, "linkedRouterApplianceInstances.instances",
621+
"linkedRouterApplianceInstances.includeImportRanges")
622+
}
623+
596624
if d.HasChange("effective_labels") {
597625
updateMask = append(updateMask, "labels")
598626
}

0 commit comments

Comments
 (0)