You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
compute: setting `google_compute_subnetwork.secondary_ip_range = []` to explicitly set a list of empty objects is deprecated and will produce an error in the upcoming major release. Use `send_secondary_ip_range_if_empty` while removing `secondary_ip_range` from config instead.
3
+
```
4
+
```release-note:enhancement
5
+
compute: added `send_secondary_ip_range_if_empty` to `google_compute_subnetwork`
@@ -251,10 +283,8 @@ to the primary ipCidrRange of the subnetwork. The alias IPs may belong
251
283
to either primary or secondary ranges.
252
284
253
285
**Note**: This field uses [attr-as-block mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html) to avoid
254
-
breaking users during the 0.12 upgrade. To explicitly send a list
255
-
of zero objects you must use the following syntax:
256
-
'example=[]'
257
-
For more details about this behavior, see [this section](https://www.terraform.io/docs/configuration/attr-as-blocks.html#defining-a-fixed-object-collection-value).`,
286
+
breaking users during the 0.12 upgrade. To explicitly send a list of zero objects,
287
+
set 'send_secondary_ip_range_if_empty = true'`,
258
288
Elem: &schema.Resource{
259
289
Schema: map[string]*schema.Schema{
260
290
"ip_cidr_range": {
@@ -307,6 +337,16 @@ outside this subnetwork.`,
307
337
Computed: true,
308
338
Description: `The range of internal IPv6 addresses that are owned by this subnetwork.`,
309
339
},
340
+
"send_secondary_ip_range_if_empty": {
341
+
Type: schema.TypeBool,
342
+
Optional: true,
343
+
Description: `Controls the removal behavior of secondary_ip_range.
344
+
When false, removing secondary_ip_range from config will not produce a diff as
345
+
the provider will default to the API's value.
346
+
When true, the provider will treat removing secondary_ip_range as sending an
347
+
empty list of secondary IP ranges to the API.
348
+
Defaults to false.`,
349
+
},
310
350
"fingerprint": {
311
351
Type: schema.TypeString,
312
352
Computed: true,
@@ -557,6 +597,7 @@ func resourceComputeSubnetworkRead(d *schema.ResourceData, meta interface{}) err
Copy file name to clipboardExpand all lines: website/docs/guides/version_6_upgrade.html.markdown
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -174,6 +174,16 @@ Previously, `containers.env` was a list, making it order-dependent. It is now a
174
174
175
175
If you were relying on accessing an individual environment variable by index (for example, `google_cloud_run_v2_service.template.containers.0.env.0.name`), then that will now need to by hash (for example, `google_cloud_run_v2_service.template.containers.0.env.<some-hash>.name`).
176
176
177
+
## Resource: `google_compute_subnetwork`
178
+
179
+
### `secondary_ip_range = []` is no longer valid configuration
180
+
181
+
To explicitly set an empty list of objects, use `send_secondary_ip_range_if_empty = true` and completely remove `secondary_ip_range` from config.
182
+
183
+
Previously, to explicitly set `secondary_ip_range` as an empty list of objects, the specific configuration `secondary_ip_range = []` was necessary.
184
+
This was to maintain compatability in behavior between Terraform versions 0.11 and 0.12 using a special setting ["attributes as blocks"](https://developer.hashicorp.com/terraform/language/attr-as-blocks).
185
+
This special setting causes other breakages so it is now removed, with `send_secondary_ip_range_if_empty` available instead.
0 commit comments