From 38430632ae1f0eab55994aec2588608fe3e5c0bc Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Tue, 26 Jul 2022 17:15:58 +0000 Subject: [PATCH] notebooks - add args + promote some args to GA (#6243) Signed-off-by: Modular Magician --- .changelog/6243.txt | 9 ++ google/resource_notebooks_instance.go | 148 +++++++++++++++++- google/resource_notebooks_runtime.go | 138 ++++++++++++++++ ...source_notebooks_runtime_generated_test.go | 107 +++++++++++++ .../docs/r/notebooks_instance.html.markdown | 8 +- .../docs/r/notebooks_runtime.html.markdown | 92 +++++++++++ 6 files changed, 494 insertions(+), 8 deletions(-) create mode 100644 .changelog/6243.txt diff --git a/.changelog/6243.txt b/.changelog/6243.txt new file mode 100644 index 00000000000..ad46dfebc1d --- /dev/null +++ b/.changelog/6243.txt @@ -0,0 +1,9 @@ +```release-note:enhancement +notebooks: promoted `nicType` and `reservationAffinity` in `google_notebooks_instance` to GA +``` +```release-note:enhancement +notebooks: added `bootDiskType` support for `PD_EXTREME` in `google_notebooks_instance` +``` +```release-note:enhancement +notebooks: added `softwareConfig.upgradeable, `softwareConfig.postStartupScriptBehavior`, `softwareConfig.kernels` in `google_notebooks_runtime` +``` diff --git a/google/resource_notebooks_instance.go b/google/resource_notebooks_instance.go index 27a3d3ef29c..5498db3c0ff 100644 --- a/google/resource_notebooks_instance.go +++ b/google/resource_notebooks_instance.go @@ -117,8 +117,8 @@ If not specified, this defaults to 100.`, Type: schema.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validateEnum([]string{"DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", ""}), - Description: `Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED"]`, + ValidateFunc: validateEnum([]string{"DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", "PD_EXTREME", ""}), + Description: `Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", "PD_EXTREME"]`, }, "container_image": { Type: schema.TypeList, @@ -165,9 +165,9 @@ If not specified, this defaults to 100.`, Type: schema.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validateEnum([]string{"DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", ""}), + ValidateFunc: validateEnum([]string{"DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", "PD_EXTREME", ""}), DiffSuppressFunc: emptyOrDefaultStringSuppress("DISK_TYPE_UNSPECIFIED"), - Description: `Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED"]`, + Description: `Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", "PD_EXTREME"]`, }, "disk_encryption": { Type: schema.TypeString, @@ -231,6 +231,13 @@ An object containing a list of "key": value pairs. Example: { "name": "wrench", Description: `The name of the VPC that this instance is in. Format: projects/{project_id}/global/networks/{network_id}`, }, + "nic_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validateEnum([]string{"UNSPECIFIED_NIC_TYPE", "VIRTIO_NET", "GVNIC", ""}), + Description: `The type of vNIC driver. Possible values: ["UNSPECIFIED_NIC_TYPE", "VIRTIO_NET", "GVNIC"]`, + }, "no_proxy_access": { Type: schema.TypeBool, Optional: true, @@ -257,6 +264,39 @@ Format: projects/{project_id}/global/networks/{network_id}`, notebook instance fully boots up. The path must be a URL or Cloud Storage path (gs://path-to-file/file-name).`, }, + "reservation_affinity": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: `Reservation Affinity for consuming Zonal reservation.`, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "consume_reservation_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validateEnum([]string{"NO_RESERVATION", "ANY_RESERVATION", "SPECIFIC_RESERVATION"}), + Description: `The type of Compute Reservation. Possible values: ["NO_RESERVATION", "ANY_RESERVATION", "SPECIFIC_RESERVATION"]`, + }, + "key": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: `Corresponds to the label key of reservation resource.`, + }, + "values": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: `Corresponds to the label values of reservation resource.`, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + }, + }, "service_account": { Type: schema.TypeString, Computed: true, @@ -452,6 +492,18 @@ func resourceNotebooksInstanceCreate(d *schema.ResourceData, meta interface{}) e } else if v, ok := d.GetOkExists("shielded_instance_config"); !isEmptyValue(reflect.ValueOf(shieldedInstanceConfigProp)) && (ok || !reflect.DeepEqual(v, shieldedInstanceConfigProp)) { obj["shieldedInstanceConfig"] = shieldedInstanceConfigProp } + nicTypeProp, err := expandNotebooksInstanceNicType(d.Get("nic_type"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("nic_type"); !isEmptyValue(reflect.ValueOf(nicTypeProp)) && (ok || !reflect.DeepEqual(v, nicTypeProp)) { + obj["nicType"] = nicTypeProp + } + reservationAffinityProp, err := expandNotebooksInstanceReservationAffinity(d.Get("reservation_affinity"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("reservation_affinity"); !isEmptyValue(reflect.ValueOf(reservationAffinityProp)) && (ok || !reflect.DeepEqual(v, reservationAffinityProp)) { + obj["reservationAffinity"] = reservationAffinityProp + } installGpuDriverProp, err := expandNotebooksInstanceInstallGpuDriver(d.Get("install_gpu_driver"), d, config) if err != nil { return err @@ -671,6 +723,12 @@ func resourceNotebooksInstanceRead(d *schema.ResourceData, meta interface{}) err if err := d.Set("shielded_instance_config", flattenNotebooksInstanceShieldedInstanceConfig(res["shieldedInstanceConfig"], d, config)); err != nil { return fmt.Errorf("Error reading Instance: %s", err) } + if err := d.Set("nic_type", flattenNotebooksInstanceNicType(res["nicType"], d, config)); err != nil { + return fmt.Errorf("Error reading Instance: %s", err) + } + if err := d.Set("reservation_affinity", flattenNotebooksInstanceReservationAffinity(res["reservationAffinity"], d, config)); err != nil { + return fmt.Errorf("Error reading Instance: %s", err) + } if err := d.Set("state", flattenNotebooksInstanceState(res["state"], d, config)); err != nil { return fmt.Errorf("Error reading Instance: %s", err) } @@ -927,6 +985,39 @@ func flattenNotebooksInstanceShieldedInstanceConfigEnableVtpm(v interface{}, d * return v } +func flattenNotebooksInstanceNicType(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return v +} + +func flattenNotebooksInstanceReservationAffinity(v interface{}, d *schema.ResourceData, config *Config) interface{} { + if v == nil { + return nil + } + original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } + transformed := make(map[string]interface{}) + transformed["consume_reservation_type"] = + flattenNotebooksInstanceReservationAffinityConsumeReservationType(original["consumeReservationType"], d, config) + transformed["key"] = + flattenNotebooksInstanceReservationAffinityKey(original["key"], d, config) + transformed["values"] = + flattenNotebooksInstanceReservationAffinityValues(original["values"], d, config) + return []interface{}{transformed} +} +func flattenNotebooksInstanceReservationAffinityConsumeReservationType(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return v +} + +func flattenNotebooksInstanceReservationAffinityKey(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return v +} + +func flattenNotebooksInstanceReservationAffinityValues(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return v +} + func flattenNotebooksInstanceState(v interface{}, d *schema.ResourceData, config *Config) interface{} { return v } @@ -1082,6 +1173,55 @@ func expandNotebooksInstanceShieldedInstanceConfigEnableVtpm(v interface{}, d Te return v, nil } +func expandNotebooksInstanceNicType(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + +func expandNotebooksInstanceReservationAffinity(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + l := v.([]interface{}) + if len(l) == 0 || l[0] == nil { + return nil, nil + } + raw := l[0] + original := raw.(map[string]interface{}) + transformed := make(map[string]interface{}) + + transformedConsumeReservationType, err := expandNotebooksInstanceReservationAffinityConsumeReservationType(original["consume_reservation_type"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedConsumeReservationType); val.IsValid() && !isEmptyValue(val) { + transformed["consumeReservationType"] = transformedConsumeReservationType + } + + transformedKey, err := expandNotebooksInstanceReservationAffinityKey(original["key"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedKey); val.IsValid() && !isEmptyValue(val) { + transformed["key"] = transformedKey + } + + transformedValues, err := expandNotebooksInstanceReservationAffinityValues(original["values"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedValues); val.IsValid() && !isEmptyValue(val) { + transformed["values"] = transformedValues + } + + return transformed, nil +} + +func expandNotebooksInstanceReservationAffinityConsumeReservationType(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + +func expandNotebooksInstanceReservationAffinityKey(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + +func expandNotebooksInstanceReservationAffinityValues(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + func expandNotebooksInstanceInstallGpuDriver(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } diff --git a/google/resource_notebooks_runtime.go b/google/resource_notebooks_runtime.go index 1e48227df12..43115bc4f29 100644 --- a/google/resource_notebooks_runtime.go +++ b/google/resource_notebooks_runtime.go @@ -143,6 +143,26 @@ Default: 180 minutes`, Optional: true, Description: `Install Nvidia Driver automatically.`, }, + "kernels": { + Type: schema.TypeList, + Optional: true, + Description: `Use a list of container images to use as Kernels in the notebook instance.`, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "repository": { + Type: schema.TypeString, + Required: true, + Description: `The path to the container image repository. +For example: gcr.io/{project_id}/{imageName}`, + }, + "tag": { + Type: schema.TypeString, + Optional: true, + Description: `The tag of the container image. If not specified, this defaults to the latest tag.`, + }, + }, + }, + }, "notebook_upgrade_schedule": { Type: schema.TypeString, Optional: true, @@ -156,6 +176,17 @@ Please follow the [cron format](https://en.wikipedia.org/wiki/Cron).`, fully boots up. The path must be a URL or Cloud Storage path (gs://path-to-file/file-name).`, }, + "post_startup_script_behavior": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateEnum([]string{"POST_STARTUP_SCRIPT_BEHAVIOR_UNSPECIFIED", "RUN_EVERY_START", "DOWNLOAD_AND_RUN_EVERY_START", ""}), + Description: `Behavior for the post startup script. Possible values: ["POST_STARTUP_SCRIPT_BEHAVIOR_UNSPECIFIED", "RUN_EVERY_START", "DOWNLOAD_AND_RUN_EVERY_START"]`, + }, + "upgradeable": { + Type: schema.TypeBool, + Computed: true, + Description: `Bool indicating whether an newer image is available in an image family.`, + }, }, }, }, @@ -1305,10 +1336,16 @@ func flattenNotebooksRuntimeSoftwareConfig(v interface{}, d *schema.ResourceData flattenNotebooksRuntimeSoftwareConfigIdleShutdownTimeout(original["idleShutdownTimeout"], d, config) transformed["install_gpu_driver"] = flattenNotebooksRuntimeSoftwareConfigInstallGpuDriver(original["installGpuDriver"], d, config) + transformed["upgradeable"] = + flattenNotebooksRuntimeSoftwareConfigUpgradeable(original["upgradeable"], d, config) transformed["custom_gpu_driver_path"] = flattenNotebooksRuntimeSoftwareConfigCustomGpuDriverPath(original["customGpuDriverPath"], d, config) transformed["post_startup_script"] = flattenNotebooksRuntimeSoftwareConfigPostStartupScript(original["postStartupScript"], d, config) + transformed["post_startup_script_behavior"] = + flattenNotebooksRuntimeSoftwareConfigPostStartupScriptBehavior(original["postStartupScriptBehavior"], d, config) + transformed["kernels"] = + flattenNotebooksRuntimeSoftwareConfigKernels(original["kernels"], d, config) return []interface{}{transformed} } func flattenNotebooksRuntimeSoftwareConfigNotebookUpgradeSchedule(v interface{}, d *schema.ResourceData, config *Config) interface{} { @@ -1344,6 +1381,10 @@ func flattenNotebooksRuntimeSoftwareConfigInstallGpuDriver(v interface{}, d *sch return v } +func flattenNotebooksRuntimeSoftwareConfigUpgradeable(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return v +} + func flattenNotebooksRuntimeSoftwareConfigCustomGpuDriverPath(v interface{}, d *schema.ResourceData, config *Config) interface{} { return v } @@ -1352,6 +1393,37 @@ func flattenNotebooksRuntimeSoftwareConfigPostStartupScript(v interface{}, d *sc return v } +func flattenNotebooksRuntimeSoftwareConfigPostStartupScriptBehavior(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return v +} + +func flattenNotebooksRuntimeSoftwareConfigKernels(v interface{}, d *schema.ResourceData, config *Config) interface{} { + if v == nil { + return v + } + l := v.([]interface{}) + transformed := make([]interface{}, 0, len(l)) + for _, raw := range l { + original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } + transformed = append(transformed, map[string]interface{}{ + "repository": flattenNotebooksRuntimeSoftwareConfigKernelsRepository(original["repository"], d, config), + "tag": flattenNotebooksRuntimeSoftwareConfigKernelsTag(original["tag"], d, config), + }) + } + return transformed +} +func flattenNotebooksRuntimeSoftwareConfigKernelsRepository(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return v +} + +func flattenNotebooksRuntimeSoftwareConfigKernelsTag(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return v +} + func flattenNotebooksRuntimeMetrics(v interface{}, d *schema.ResourceData, config *Config) interface{} { if v == nil { return nil @@ -2041,6 +2113,13 @@ func expandNotebooksRuntimeSoftwareConfig(v interface{}, d TerraformResourceData transformed["installGpuDriver"] = transformedInstallGpuDriver } + transformedUpgradeable, err := expandNotebooksRuntimeSoftwareConfigUpgradeable(original["upgradeable"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedUpgradeable); val.IsValid() && !isEmptyValue(val) { + transformed["upgradeable"] = transformedUpgradeable + } + transformedCustomGpuDriverPath, err := expandNotebooksRuntimeSoftwareConfigCustomGpuDriverPath(original["custom_gpu_driver_path"], d, config) if err != nil { return nil, err @@ -2055,6 +2134,20 @@ func expandNotebooksRuntimeSoftwareConfig(v interface{}, d TerraformResourceData transformed["postStartupScript"] = transformedPostStartupScript } + transformedPostStartupScriptBehavior, err := expandNotebooksRuntimeSoftwareConfigPostStartupScriptBehavior(original["post_startup_script_behavior"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedPostStartupScriptBehavior); val.IsValid() && !isEmptyValue(val) { + transformed["postStartupScriptBehavior"] = transformedPostStartupScriptBehavior + } + + transformedKernels, err := expandNotebooksRuntimeSoftwareConfigKernels(original["kernels"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedKernels); val.IsValid() && !isEmptyValue(val) { + transformed["kernels"] = transformedKernels + } + return transformed, nil } @@ -2078,6 +2171,10 @@ func expandNotebooksRuntimeSoftwareConfigInstallGpuDriver(v interface{}, d Terra return v, nil } +func expandNotebooksRuntimeSoftwareConfigUpgradeable(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + func expandNotebooksRuntimeSoftwareConfigCustomGpuDriverPath(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } @@ -2085,3 +2182,44 @@ func expandNotebooksRuntimeSoftwareConfigCustomGpuDriverPath(v interface{}, d Te func expandNotebooksRuntimeSoftwareConfigPostStartupScript(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } + +func expandNotebooksRuntimeSoftwareConfigPostStartupScriptBehavior(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + +func expandNotebooksRuntimeSoftwareConfigKernels(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + l := v.([]interface{}) + req := make([]interface{}, 0, len(l)) + for _, raw := range l { + if raw == nil { + continue + } + original := raw.(map[string]interface{}) + transformed := make(map[string]interface{}) + + transformedRepository, err := expandNotebooksRuntimeSoftwareConfigKernelsRepository(original["repository"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedRepository); val.IsValid() && !isEmptyValue(val) { + transformed["repository"] = transformedRepository + } + + transformedTag, err := expandNotebooksRuntimeSoftwareConfigKernelsTag(original["tag"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedTag); val.IsValid() && !isEmptyValue(val) { + transformed["tag"] = transformedTag + } + + req = append(req, transformed) + } + return req, nil +} + +func expandNotebooksRuntimeSoftwareConfigKernelsRepository(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + +func expandNotebooksRuntimeSoftwareConfigKernelsTag(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} diff --git a/google/resource_notebooks_runtime_generated_test.go b/google/resource_notebooks_runtime_generated_test.go index 7878ff30dab..8c114fd063e 100644 --- a/google/resource_notebooks_runtime_generated_test.go +++ b/google/resource_notebooks_runtime_generated_test.go @@ -185,6 +185,113 @@ resource "google_notebooks_runtime" "runtime_container" { `, context) } +func TestAccNotebooksRuntime_notebookRuntimeKernelsExample(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": randString(t, 10), + } + + vcrTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckNotebooksRuntimeDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccNotebooksRuntime_notebookRuntimeKernelsExample(context), + }, + { + ResourceName: "google_notebooks_runtime.runtime_container", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"name", "location"}, + }, + }, + }) +} + +func testAccNotebooksRuntime_notebookRuntimeKernelsExample(context map[string]interface{}) string { + return Nprintf(` +resource "google_notebooks_runtime" "runtime_container" { + name = "tf-test-notebooks-runtime-kernel%{random_suffix}" + location = "us-central1" + access_config { + access_type = "SINGLE_USER" + runtime_owner = "admin@hashicorptest.com" + } + software_config { + kernels { + repository = "gcr.io/deeplearning-platform-release/base-cpu" + tag = "latest" + } + } + virtual_machine { + virtual_machine_config { + machine_type = "n1-standard-4" + data_disk { + initialize_params { + disk_size_gb = "100" + disk_type = "PD_STANDARD" + } + } + } + } +} +`, context) +} + +func TestAccNotebooksRuntime_notebookRuntimeScriptExample(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": randString(t, 10), + } + + vcrTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckNotebooksRuntimeDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccNotebooksRuntime_notebookRuntimeScriptExample(context), + }, + { + ResourceName: "google_notebooks_runtime.runtime_container", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"name", "location"}, + }, + }, + }) +} + +func testAccNotebooksRuntime_notebookRuntimeScriptExample(context map[string]interface{}) string { + return Nprintf(` +resource "google_notebooks_runtime" "runtime_container" { + name = "tf-test-notebooks-runtime-script%{random_suffix}" + location = "us-central1" + access_config { + access_type = "SINGLE_USER" + runtime_owner = "admin@hashicorptest.com" + } + software_config { + post_startup_script_behavior = "RUN_EVERY_START" + } + virtual_machine { + virtual_machine_config { + machine_type = "n1-standard-4" + data_disk { + initialize_params { + disk_size_gb = "100" + disk_type = "PD_STANDARD" + } + } + } + } +} +`, context) +} + func testAccCheckNotebooksRuntimeDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { for name, rs := range s.RootModule().Resources { diff --git a/website/docs/r/notebooks_instance.html.markdown b/website/docs/r/notebooks_instance.html.markdown index aa02c488b88..543a0da48a9 100644 --- a/website/docs/r/notebooks_instance.html.markdown +++ b/website/docs/r/notebooks_instance.html.markdown @@ -211,12 +211,12 @@ The following arguments are supported: Structure is [documented below](#nested_shielded_instance_config). * `nic_type` - - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) + (Optional) The type of vNIC driver. Possible values are `UNSPECIFIED_NIC_TYPE`, `VIRTIO_NET`, and `GVNIC`. * `reservation_affinity` - - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) + (Optional) Reservation Affinity for consuming Zonal reservation. Structure is [documented below](#nested_reservation_affinity). @@ -234,7 +234,7 @@ The following arguments are supported: * `boot_disk_type` - (Optional) Possible disk types for notebook instances. - Possible values are `DISK_TYPE_UNSPECIFIED`, `PD_STANDARD`, `PD_SSD`, and `PD_BALANCED`. + Possible values are `DISK_TYPE_UNSPECIFIED`, `PD_STANDARD`, `PD_SSD`, `PD_BALANCED`, and `PD_EXTREME`. * `boot_disk_size_gb` - (Optional) @@ -245,7 +245,7 @@ The following arguments are supported: * `data_disk_type` - (Optional) Possible disk types for notebook instances. - Possible values are `DISK_TYPE_UNSPECIFIED`, `PD_STANDARD`, `PD_SSD`, and `PD_BALANCED`. + Possible values are `DISK_TYPE_UNSPECIFIED`, `PD_STANDARD`, `PD_SSD`, `PD_BALANCED`, and `PD_EXTREME`. * `data_disk_size_gb` - (Optional) diff --git a/website/docs/r/notebooks_runtime.html.markdown b/website/docs/r/notebooks_runtime.html.markdown index d298e59c1f5..9209318f3cb 100644 --- a/website/docs/r/notebooks_runtime.html.markdown +++ b/website/docs/r/notebooks_runtime.html.markdown @@ -136,6 +136,73 @@ resource "google_notebooks_runtime" "runtime_container" { } } ``` + +## Example Usage - Notebook Runtime Kernels + + +```hcl +resource "google_notebooks_runtime" "runtime_container" { + name = "notebooks-runtime-kernel" + location = "us-central1" + access_config { + access_type = "SINGLE_USER" + runtime_owner = "admin@hashicorptest.com" + } + software_config { + kernels { + repository = "gcr.io/deeplearning-platform-release/base-cpu" + tag = "latest" + } + } + virtual_machine { + virtual_machine_config { + machine_type = "n1-standard-4" + data_disk { + initialize_params { + disk_size_gb = "100" + disk_type = "PD_STANDARD" + } + } + } + } +} +``` + +## Example Usage - Notebook Runtime Script + + +```hcl +resource "google_notebooks_runtime" "runtime_container" { + name = "notebooks-runtime-script" + location = "us-central1" + access_config { + access_type = "SINGLE_USER" + runtime_owner = "admin@hashicorptest.com" + } + software_config { + post_startup_script_behavior = "RUN_EVERY_START" + } + virtual_machine { + virtual_machine_config { + machine_type = "n1-standard-4" + data_disk { + initialize_params { + disk_size_gb = "100" + disk_type = "PD_STANDARD" + } + } + } + } +} +``` ## Argument Reference @@ -504,6 +571,9 @@ The following arguments are supported: (Optional) Install Nvidia Driver automatically. +* `upgradeable` - + Bool indicating whether an newer image is available in an image family. + * `custom_gpu_driver_path` - (Optional) Specify a custom Cloud Storage path where the GPU driver is stored. @@ -515,6 +585,28 @@ The following arguments are supported: fully boots up. The path must be a URL or Cloud Storage path (gs://path-to-file/file-name). +* `post_startup_script_behavior` - + (Optional) + Behavior for the post startup script. + Possible values are `POST_STARTUP_SCRIPT_BEHAVIOR_UNSPECIFIED`, `RUN_EVERY_START`, and `DOWNLOAD_AND_RUN_EVERY_START`. + +* `kernels` - + (Optional) + Use a list of container images to use as Kernels in the notebook instance. + Structure is [documented below](#nested_kernels). + + +The `kernels` block supports: + +* `repository` - + (Required) + The path to the container image repository. + For example: gcr.io/{project_id}/{imageName} + +* `tag` - + (Optional) + The tag of the container image. If not specified, this defaults to the latest tag. + ## Attributes Reference In addition to the arguments listed above, the following computed attributes are exported: