Skip to content

Commit 364d947

Browse files
Remove incomplete ValidateFunc for disk type. (#5993) (#11630)
Existing ValidateFunc was missing more recent Persistent Disk types, like pd-balanced / pd-extreme. This change should prevent the list of valid disk type options from being stale in the future. Signed-off-by: Modular Magician <[email protected]>
1 parent 1ef3676 commit 364d947

8 files changed

+25
-20
lines changed

.changelog/5993.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
```release-note:enhancement
2+
compute: removed validation checking against a fixed set of persistent disk types
3+
```
4+
```release-note:enhancement
5+
container: removed validation checking against a fixed set of persistent disk types
6+
```
7+
```release-note:enhancement
8+
dataproc: removed validation checking against a fixed set of persistent disk types
9+
```

google/node_config.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ func schemaNodeConfig() *schema.Schema {
3636
},
3737

3838
"disk_type": {
39-
Type: schema.TypeString,
40-
Optional: true,
41-
Computed: true,
42-
ForceNew: true,
43-
ValidateFunc: validation.StringInSlice([]string{"pd-standard", "pd-balanced", "pd-ssd"}, false),
44-
Description: `Type of the disk attached to each node.`,
39+
Type: schema.TypeString,
40+
Optional: true,
41+
Computed: true,
42+
ForceNew: true,
43+
Description: `Type of the disk attached to each node. Such as pd-standard, pd-balanced or pd-ssd`,
4544
},
4645

4746
"guest_accelerator": {

google/resource_compute_instance.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ func resourceComputeInstance() *schema.Resource {
189189
AtLeastOneOf: initializeParamsKeys,
190190
Computed: true,
191191
ForceNew: true,
192-
ValidateFunc: validation.StringInSlice([]string{"pd-standard", "pd-ssd", "pd-balanced"}, false),
193-
Description: `The Google Compute Engine disk type. One of pd-standard, pd-ssd or pd-balanced.`,
192+
Description: `The Google Compute Engine disk type. Such as pd-standard, pd-ssd or pd-balanced.`,
194193
},
195194

196195
"image": {

google/resource_compute_instance_template.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func resourceComputeInstanceTemplate() *schema.Resource {
139139
Optional: true,
140140
ForceNew: true,
141141
Computed: true,
142-
Description: `The Google Compute Engine disk type. Can be either "pd-ssd", "local-ssd", "pd-balanced" or "pd-standard".`,
142+
Description: `The Google Compute Engine disk type. Such as "pd-ssd", "local-ssd", "pd-balanced" or "pd-standard".`,
143143
},
144144

145145
"labels": {

google/resource_dataproc_cluster.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,8 @@ func resourceDataprocCluster() *schema.Resource {
401401
Optional: true,
402402
AtLeastOneOf: preemptibleWorkerDiskConfigKeys,
403403
ForceNew: true,
404-
ValidateFunc: validation.StringInSlice([]string{"pd-standard", "pd-ssd", ""}, false),
405404
Default: "pd-standard",
406-
Description: `The disk type of the primary disk attached to each preemptible worker node. One of "pd-ssd" or "pd-standard". Defaults to "pd-standard".`,
405+
Description: `The disk type of the primary disk attached to each preemptible worker node. Such as "pd-ssd" or "pd-standard". Defaults to "pd-standard".`,
407406
},
408407
},
409408
},
@@ -734,15 +733,14 @@ func instanceConfigSchema(parent string) *schema.Schema {
734733
"boot_disk_type": {
735734
Type: schema.TypeString,
736735
Optional: true,
737-
Description: `The disk type of the primary disk attached to each node. One of "pd-ssd" or "pd-standard". Defaults to "pd-standard".`,
736+
Description: `The disk type of the primary disk attached to each node. Such as "pd-ssd" or "pd-standard". Defaults to "pd-standard".`,
738737
AtLeastOneOf: []string{
739738
"cluster_config.0." + parent + ".0.disk_config.0.num_local_ssds",
740739
"cluster_config.0." + parent + ".0.disk_config.0.boot_disk_size_gb",
741740
"cluster_config.0." + parent + ".0.disk_config.0.boot_disk_type",
742741
},
743-
ForceNew: true,
744-
ValidateFunc: validation.StringInSlice([]string{"pd-standard", "pd-ssd", ""}, false),
745-
Default: "pd-standard",
742+
ForceNew: true,
743+
Default: "pd-standard",
746744
},
747745
},
748746
},

website/docs/d/compute_instance_template.html.markdown

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ The following arguments are supported:
153153
of the disk (such as those managed by `google_compute_disk`) to attach.
154154
~> **Note:** Either `source` or `source_image` is **required** in a disk block unless the disk type is `local-ssd`. Check the API [docs](https://cloud.google.com/compute/docs/reference/rest/v1/instanceTemplates/insert) for details.
155155

156-
* `disk_type` - The GCE disk type. Can be either `"pd-ssd"`,
157-
`"local-ssd"`, `"pd-balanced"` or `"pd-standard"`.
156+
* `disk_type` - The GCE disk type. Such as `"pd-ssd"`, `"local-ssd"`,
157+
`"pd-balanced"` or `"pd-standard"`.
158158

159159
* `disk_size_gb` - The size of the image in gigabytes. If not
160160
specified, it will inherit the size of its base image. For SCRATCH disks,

website/docs/r/compute_instance.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ is desired, you will need to modify your state file manually using
221221
* `size` - (Optional) The size of the image in gigabytes. If not specified, it
222222
will inherit the size of its base image.
223223

224-
* `type` - (Optional) The GCE disk type. May be set to pd-standard, pd-balanced or pd-ssd.
224+
* `type` - (Optional) The GCE disk type. Such as pd-standard, pd-balanced or pd-ssd.
225225

226226
* `image` - (Optional) The image from which to initialize this disk. This can be
227227
one of: the image's `self_link`, `projects/{project}/global/images/{image}`,

website/docs/r/compute_instance_template.html.markdown

+2-2
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,8 @@ The following arguments are supported:
399399
of the disk (such as those managed by `google_compute_disk`) to attach.
400400
~> **Note:** Either `source` or `source_image` is **required** in a disk block unless the disk type is `local-ssd`. Check the API [docs](https://cloud.google.com/compute/docs/reference/rest/v1/instanceTemplates/insert) for details.
401401

402-
* `disk_type` - (Optional) The GCE disk type. Can be either `"pd-ssd"`,
403-
`"local-ssd"`, `"pd-balanced"` or `"pd-standard"`.
402+
* `disk_type` - (Optional) The GCE disk type. Such as `"pd-ssd"`, `"local-ssd"`,
403+
`"pd-balanced"` or `"pd-standard"`.
404404

405405
* `disk_size_gb` - (Optional) The size of the image in gigabytes. If not
406406
specified, it will inherit the size of its base image. For SCRATCH disks,

0 commit comments

Comments
 (0)