mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-09 11:38:29 +00:00
container_cluster: added disk_type node configuration
Added node config 'disk_type' which can either be 'pd-standard' or 'pd-ssd', if left blank 'pd-standard' will be the default used by google cloud. Closes: #1656
This commit is contained in:
parent
43cccf3e2c
commit
d0890dc2b7
|
@ -1,11 +1,12 @@
|
||||||
package google
|
package google
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/helper/schema"
|
"github.com/hashicorp/terraform/helper/schema"
|
||||||
"github.com/hashicorp/terraform/helper/validation"
|
"github.com/hashicorp/terraform/helper/validation"
|
||||||
containerBeta "google.golang.org/api/container/v1beta1"
|
containerBeta "google.golang.org/api/container/v1beta1"
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Matches gke-default scope from https://cloud.google.com/sdk/gcloud/reference/container/clusters/create
|
// Matches gke-default scope from https://cloud.google.com/sdk/gcloud/reference/container/clusters/create
|
||||||
|
@ -34,6 +35,14 @@ var schemaNodeConfig = &schema.Schema{
|
||||||
ValidateFunc: validation.IntAtLeast(10),
|
ValidateFunc: validation.IntAtLeast(10),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"disk_type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
ForceNew: true,
|
||||||
|
ValidateFunc: validation.StringInSlice([]string{"pd-standard", "pd-ssd"}, false),
|
||||||
|
},
|
||||||
|
|
||||||
"guest_accelerator": &schema.Schema{
|
"guest_accelerator": &schema.Schema{
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
@ -216,6 +225,10 @@ func expandNodeConfig(v interface{}) *containerBeta.NodeConfig {
|
||||||
nc.DiskSizeGb = int64(v.(int))
|
nc.DiskSizeGb = int64(v.(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v, ok := nodeConfig["disk_type"]; ok {
|
||||||
|
nc.DiskType = v.(string)
|
||||||
|
}
|
||||||
|
|
||||||
if v, ok := nodeConfig["local_ssd_count"]; ok {
|
if v, ok := nodeConfig["local_ssd_count"]; ok {
|
||||||
nc.LocalSsdCount = int64(v.(int))
|
nc.LocalSsdCount = int64(v.(int))
|
||||||
}
|
}
|
||||||
|
@ -304,6 +317,7 @@ func flattenNodeConfig(c *containerBeta.NodeConfig) []map[string]interface{} {
|
||||||
config = append(config, map[string]interface{}{
|
config = append(config, map[string]interface{}{
|
||||||
"machine_type": c.MachineType,
|
"machine_type": c.MachineType,
|
||||||
"disk_size_gb": c.DiskSizeGb,
|
"disk_size_gb": c.DiskSizeGb,
|
||||||
|
"disk_type": c.DiskType,
|
||||||
"guest_accelerator": flattenContainerGuestAccelerators(c.Accelerators),
|
"guest_accelerator": flattenContainerGuestAccelerators(c.Accelerators),
|
||||||
"local_ssd_count": c.LocalSsdCount,
|
"local_ssd_count": c.LocalSsdCount,
|
||||||
"service_account": c.ServiceAccount,
|
"service_account": c.ServiceAccount,
|
||||||
|
|
|
@ -1631,6 +1631,7 @@ resource "google_container_cluster" "with_node_config" {
|
||||||
node_config {
|
node_config {
|
||||||
machine_type = "n1-standard-1"
|
machine_type = "n1-standard-1"
|
||||||
disk_size_gb = 15
|
disk_size_gb = 15
|
||||||
|
disk_type = "pd-ssd"
|
||||||
local_ssd_count = 1
|
local_ssd_count = 1
|
||||||
oauth_scopes = [
|
oauth_scopes = [
|
||||||
"https://www.googleapis.com/auth/monitoring",
|
"https://www.googleapis.com/auth/monitoring",
|
||||||
|
|
|
@ -267,6 +267,9 @@ The `node_config` block supports:
|
||||||
* `disk_size_gb` - (Optional) Size of the disk attached to each node, specified
|
* `disk_size_gb` - (Optional) Size of the disk attached to each node, specified
|
||||||
in GB. The smallest allowed disk size is 10GB. Defaults to 100GB.
|
in GB. The smallest allowed disk size is 10GB. Defaults to 100GB.
|
||||||
|
|
||||||
|
* `disk_type` - (Optional) Type of the disk attached to each node
|
||||||
|
(e.g. 'pd-standard' or 'pd-ssd'). If unspecified, the default disk type is 'pd-standard'
|
||||||
|
|
||||||
* `guest_accelerator` - (Optional) List of the type and count of accelerator cards attached to the instance.
|
* `guest_accelerator` - (Optional) List of the type and count of accelerator cards attached to the instance.
|
||||||
Structure documented below.
|
Structure documented below.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user