diff --git a/mmv1/third_party/terraform/services/container/node_config.go.erb b/mmv1/third_party/terraform/services/container/node_config.go.erb index f4f0da9b05ed..7c55d6320e8d 100644 --- a/mmv1/third_party/terraform/services/container/node_config.go.erb +++ b/mmv1/third_party/terraform/services/container/node_config.go.erb @@ -109,6 +109,25 @@ func schemaNodeConfig() *schema.Schema { DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, Description: `The accelerator type resource name.`, }, + "gpu_driver_installation_config": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + ForceNew: true, + ConfigMode: schema.SchemaConfigModeAttr, + Description: `Configuration for auto installation of GPU driver.`, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "gpu_driver_version": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `Mode for how the GPU driver is installed.`, + ValidateFunc: validation.StringInSlice([]string{"GPU_DRIVER_VERSION_UNSPECIFIED", "INSTALLATION_DISABLED", "DEFAULT", "LATEST"}, false), + }, + }, + }, + }, "gpu_partition_size": &schema.Schema{ Type: schema.TypeString, Optional: true, @@ -648,6 +667,13 @@ func expandNodeConfig(v interface{}) *container.NodeConfig { GpuPartitionSize: data["gpu_partition_size"].(string), } + if v, ok := data["gpu_driver_installation_config"]; ok && len(v.([]interface{})) > 0 { + gpuDriverInstallationConfig := data["gpu_driver_installation_config"].([]interface{})[0].(map[string]interface{}) + guestAcceleratorConfig.GpuDriverInstallationConfig = &container.GPUDriverInstallationConfig{ + GpuDriverVersion: gpuDriverInstallationConfig["gpu_driver_version"].(string), + } + } + if v, ok := data["gpu_sharing_config"]; ok && len(v.([]interface{})) > 0 { gpuSharingConfig := data["gpu_sharing_config"].([]interface{})[0].(map[string]interface{}) guestAcceleratorConfig.GpuSharingConfig = &container.GPUSharingConfig{ @@ -1043,6 +1069,13 @@ func flattenContainerGuestAccelerators(c []*container.AcceleratorConfig) []map[s "type": accel.AcceleratorType, "gpu_partition_size": accel.GpuPartitionSize, } + if accel.GpuDriverInstallationConfig != nil { + accelerator["gpu_driver_installation_config"] = []map[string]interface{}{ + { + "gpu_driver_version": accel.GpuDriverInstallationConfig.GpuDriverVersion, + }, + } + } if accel.GpuSharingConfig != nil { accelerator["gpu_sharing_config"] = []map[string]interface{}{ { diff --git a/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb index f8c51ab791f3..1e46eaac15b4 100644 --- a/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb @@ -2739,6 +2739,9 @@ resource "google_container_node_pool" "np_with_gpu" { type = "nvidia-tesla-a100" gpu_partition_size = "1g.5gb" count = 1 + gpu_driver_installation_config { + gpu_driver_version = "LATEST" + } gpu_sharing_config { gpu_sharing_strategy = "TIME_SHARING" max_shared_clients_per_gpu = 2 diff --git a/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown b/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown index df41e17b9104..d4ca086606d7 100644 --- a/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown @@ -948,6 +948,17 @@ sole_tenant_config { * `count` (Required) - The number of the guest accelerator cards exposed to this instance. +* `gpu_driver_installation_config` (Optional) - Configuration for auto installation of GPU driver. Structure is [documented below](#nested_gpu_driver_installation_config). + +The `gpu_driver_installation_config` block supports: + +* `gpu_driver_version` (Required) - Mode for how the GPU driver is installed. + Accepted values are: + * `"GPU_DRIVER_VERSION_UNSPECIFIED"`: Default value is to not install any GPU driver. + * `"INSTALLATION_DISABLED"`: Disable GPU driver auto installation and needs manual installation. + * `"DEFAULT"`: "Default" GPU driver in COS and Ubuntu. + * `"LATEST"`: "Latest" GPU driver in COS. + * `gpu_partition_size` (Optional) - Size of partitions to create on the GPU. Valid values are described in the NVIDIA mig [user guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning). * `gpu_sharing_config` (Optional) - Configuration for GPU sharing. Structure is [documented below](#nested_gpu_sharing_config).