Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Network Connectivity Spoke Router and VPN Tunnels #8883

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changelog/12519.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```release-note:enhancement
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`
```
```release-note:bug
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.
```
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ Please refer to the field 'effective_labels' for all of the labels present on th
"linked_interconnect_attachments": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
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.`,
MaxItems: 1,
Elem: &schema.Resource{
Expand Down Expand Up @@ -176,7 +175,6 @@ The only allowed value for now is "ALL_IPV4_RANGES".`,
"linked_router_appliance_instances": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Description: `The URIs of linked Router appliance resources`,
MaxItems: 1,
Elem: &schema.Resource{
Expand All @@ -190,13 +188,13 @@ The only allowed value for now is "ALL_IPV4_RANGES".`,
Schema: map[string]*schema.Schema{
"ip_address": {
Type: schema.TypeString,
Optional: true,
Required: true,
ForceNew: true,
Description: `The IP address on the VM to use for peering.`,
},
"virtual_machine": {
Type: schema.TypeString,
Optional: true,
Required: true,
ForceNew: true,
DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName,
Description: `The URI of the virtual machine resource`,
Expand Down Expand Up @@ -263,7 +261,6 @@ The only allowed value for now is "ALL_IPV4_RANGES".`,
"linked_vpn_tunnels": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Description: `The URIs of linked VPN tunnel resources`,
MaxItems: 1,
Elem: &schema.Resource{
Expand Down Expand Up @@ -573,6 +570,24 @@ func resourceNetworkConnectivitySpokeUpdate(d *schema.ResourceData, meta interfa
} else if v, ok := d.GetOkExists("description"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
obj["description"] = descriptionProp
}
linkedVpnTunnelsProp, err := expandNetworkConnectivitySpokeLinkedVpnTunnels(d.Get("linked_vpn_tunnels"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("linked_vpn_tunnels"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, linkedVpnTunnelsProp)) {
obj["linkedVpnTunnels"] = linkedVpnTunnelsProp
}
linkedInterconnectAttachmentsProp, err := expandNetworkConnectivitySpokeLinkedInterconnectAttachments(d.Get("linked_interconnect_attachments"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("linked_interconnect_attachments"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, linkedInterconnectAttachmentsProp)) {
obj["linkedInterconnectAttachments"] = linkedInterconnectAttachmentsProp
}
linkedRouterApplianceInstancesProp, err := expandNetworkConnectivitySpokeLinkedRouterApplianceInstances(d.Get("linked_router_appliance_instances"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("linked_router_appliance_instances"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, linkedRouterApplianceInstancesProp)) {
obj["linkedRouterApplianceInstances"] = linkedRouterApplianceInstancesProp
}
labelsProp, err := expandNetworkConnectivitySpokeEffectiveLabels(d.Get("effective_labels"), d, config)
if err != nil {
return err
Expand All @@ -593,6 +608,19 @@ func resourceNetworkConnectivitySpokeUpdate(d *schema.ResourceData, meta interfa
updateMask = append(updateMask, "description")
}

if d.HasChange("linked_vpn_tunnels") {
updateMask = append(updateMask, "linkedVpnTunnels.includeImportRanges")
}

if d.HasChange("linked_interconnect_attachments") {
updateMask = append(updateMask, "linkedInterconnectAttachments.includeImportRanges")
}

if d.HasChange("linked_router_appliance_instances") {
updateMask = append(updateMask, "linkedRouterApplianceInstances.instances",
"linkedRouterApplianceInstances.includeImportRanges")
}

if d.HasChange("effective_labels") {
updateMask = append(updateMask, "labels")
}
Expand Down
Loading
Loading