Skip to content

Commit

Permalink
update external_ipv6_prefix to not be output only (#9096) (#16480)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
modular-magician authored Nov 9, 2023
1 parent 959623e commit adad008
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .changelog/9096.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
compute: changed `external_ipv6_prefix` field on `google_compute_subnetwork` resource to not be output only
```
22 changes: 17 additions & 5 deletions google/services/compute/resource_compute_subnetwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
7 changes: 4 additions & 3 deletions website/docs/r/compute_subnetwork.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.


Expand Down

0 comments on commit adad008

Please sign in to comment.