From adad0083a54713eedff133dc3cbd78ccd5707797 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 8 Nov 2023 18:18:18 -0800 Subject: [PATCH] update `external_ipv6_prefix` to not be output only (#9096) (#16480) * update externalIpv6Prefex to not be output only * WIP: adding attribute to update tests * remove tests * remove update4 config * Update mmv1/products/compute/Subnetwork.yaml * add back internalipv6 test * add endline * fix lint error --------- [upstream:6e6e56eb11daa9dea7d9da7f67f9145cb764c872] Signed-off-by: Modular Magician --- .changelog/9096.txt | 3 +++ .../compute/resource_compute_subnetwork.go | 22 ++++++++++++++----- .../docs/r/compute_subnetwork.html.markdown | 7 +++--- 3 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 .changelog/9096.txt diff --git a/.changelog/9096.txt b/.changelog/9096.txt new file mode 100644 index 00000000000..ce6987b7223 --- /dev/null +++ b/.changelog/9096.txt @@ -0,0 +1,3 @@ +```release-note:bug +compute: changed `external_ipv6_prefix` field on `google_compute_subnetwork` resource to not be output only +``` diff --git a/google/services/compute/resource_compute_subnetwork.go b/google/services/compute/resource_compute_subnetwork.go index 1a5c670f736..4c6b2ccda66 100644 --- a/google/services/compute/resource_compute_subnetwork.go +++ b/google/services/compute/resource_compute_subnetwork.go @@ -116,6 +116,13 @@ Only networks that are in the distributed mode can have subnetworks.`, you create the resource. This field can be set only at resource creation time.`, }, + "external_ipv6_prefix": { + Type: schema.TypeString, + Computed: true, + Optional: true, + ForceNew: true, + Description: `The range of external IPv6 addresses that are owned by this subnetwork.`, + }, "ipv6_access_type": { Type: schema.TypeString, Optional: true, @@ -283,11 +290,6 @@ If not specified IPV4_ONLY will be used. Possible values: ["IPV4_ONLY", "IPV4_IP Computed: true, Description: `Creation timestamp in RFC3339 text format.`, }, - "external_ipv6_prefix": { - Type: schema.TypeString, - Computed: true, - Description: `The range of external IPv6 addresses that are owned by this subnetwork.`, - }, "gateway_address": { Type: schema.TypeString, Computed: true, @@ -453,6 +455,12 @@ func resourceComputeSubnetworkCreate(d *schema.ResourceData, meta interface{}) e } else if v, ok := d.GetOkExists("ipv6_access_type"); !tpgresource.IsEmptyValue(reflect.ValueOf(ipv6AccessTypeProp)) && (ok || !reflect.DeepEqual(v, ipv6AccessTypeProp)) { obj["ipv6AccessType"] = ipv6AccessTypeProp } + externalIpv6PrefixProp, err := expandComputeSubnetworkExternalIpv6Prefix(d.Get("external_ipv6_prefix"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("external_ipv6_prefix"); !tpgresource.IsEmptyValue(reflect.ValueOf(externalIpv6PrefixProp)) && (ok || !reflect.DeepEqual(v, externalIpv6PrefixProp)) { + obj["externalIpv6Prefix"] = externalIpv6PrefixProp + } url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/subnetworks") if err != nil { @@ -1311,3 +1319,7 @@ func expandComputeSubnetworkStackType(v interface{}, d tpgresource.TerraformReso func expandComputeSubnetworkIpv6AccessType(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return v, nil } + +func expandComputeSubnetworkExternalIpv6Prefix(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} diff --git a/website/docs/r/compute_subnetwork.html.markdown b/website/docs/r/compute_subnetwork.html.markdown index 766d0447383..dcca9641c69 100644 --- a/website/docs/r/compute_subnetwork.html.markdown +++ b/website/docs/r/compute_subnetwork.html.markdown @@ -339,6 +339,10 @@ The following arguments are supported: cannot enable direct path. Possible values are: `EXTERNAL`, `INTERNAL`. +* `external_ipv6_prefix` - + (Optional) + The range of external IPv6 addresses that are owned by this subnetwork. + * `allow_subnet_cidr_routes_overlap` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) Typically packets destined to IPs within the subnetwork range that do not match @@ -422,9 +426,6 @@ In addition to the arguments listed above, the following computed attributes are * `internal_ipv6_prefix` - The internal IPv6 address range that is assigned to this subnetwork. - -* `external_ipv6_prefix` - - The range of external IPv6 addresses that are owned by this subnetwork. * `self_link` - The URI of the created resource.