blob: bfcca3771583078d608d293290d6c1b7dfb91202 [file] [log] [blame] [edit]
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Cloud AI Notebooks"
description: |-
A Cloud AI Platform Notebook instance.
---
# google_notebooks_instance
~> **Warning:** `google_notebook_instance` is deprecated and will be removed in a future major release. Use `google_workbench_instance` instead.
A Cloud AI Platform Notebook instance.
~> **Note:** Due to limitations of the Notebooks Instance API, many fields
in this resource do not properly detect drift. These fields will also not
appear in state once imported.
To get more information about Instance, see:
* [API documentation](https://cloud.google.com/ai-platform/notebooks/docs/reference/rest)
* How-to Guides
* [Official Documentation](https://cloud.google.com/ai-platform-notebooks)
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=notebook_instance_basic&open_in_editor=main.tf" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Notebook Instance Basic
```hcl
resource "google_notebooks_instance" "instance" {
name = "notebooks-instance"
location = "us-west1-a"
machine_type = "e2-medium"
vm_image {
project = "deeplearning-platform-release"
image_family = "tf-latest-cpu"
}
}
```
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=notebook_instance_basic_stopped&open_in_editor=main.tf" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Notebook Instance Basic Stopped
```hcl
resource "google_notebooks_instance" "instance" {
name = "notebooks-instance"
location = "us-west1-a"
machine_type = "e2-medium"
vm_image {
project = "deeplearning-platform-release"
image_family = "tf-latest-cpu"
}
desired_state = "STOPPED"
}
```
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=notebook_instance_basic_container&open_in_editor=main.tf" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Notebook Instance Basic Container
```hcl
resource "google_notebooks_instance" "instance" {
name = "notebooks-instance"
location = "us-west1-a"
machine_type = "e2-medium"
metadata = {
proxy-mode = "service_account"
terraform = "true"
}
container_image {
repository = "gcr.io/deeplearning-platform-release/base-cpu"
tag = "latest"
}
}
```
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=notebook_instance_basic_gpu&open_in_editor=main.tf" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Notebook Instance Basic Gpu
```hcl
resource "google_notebooks_instance" "instance" {
name = "notebooks-instance"
location = "us-west1-a"
machine_type = "n1-standard-1" // can't be e2 because of accelerator
install_gpu_driver = true
accelerator_config {
type = "NVIDIA_TESLA_T4"
core_count = 1
}
vm_image {
project = "deeplearning-platform-release"
image_family = "tf-latest-gpu"
}
}
```
## Example Usage - Notebook Instance Full
```hcl
resource "google_notebooks_instance" "instance" {
name = "notebooks-instance"
location = "us-central1-a"
machine_type = "e2-medium"
vm_image {
project = "deeplearning-platform-release"
image_family = "tf-latest-cpu"
}
instance_owners = [ "my@service-account.com"]
service_account = "my@service-account.com"
install_gpu_driver = true
boot_disk_type = "PD_SSD"
boot_disk_size_gb = 110
no_public_ip = true
no_proxy_access = true
network = data.google_compute_network.my_network.id
subnet = data.google_compute_subnetwork.my_subnetwork.id
labels = {
k = "val"
}
metadata = {
terraform = "true"
}
service_account_scopes = [
"https://www.googleapis.com/auth/bigquery",
"https://www.googleapis.com/auth/devstorage.read_write",
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/userinfo.email"
]
tags = ["foo", "bar"]
disk_encryption = "CMEK"
kms_key = "my-crypto-key"
desired_state = "ACTIVE"
}
data "google_compute_network" "my_network" {
name = "default"
}
data "google_compute_subnetwork" "my_subnetwork" {
name = "default"
region = "us-central1"
}
```
## Argument Reference
The following arguments are supported:
* `name` -
(Required)
The name specified for the Notebook instance.
* `machine_type` -
(Required)
A reference to a machine type which defines VM kind.
* `location` -
(Required)
A reference to the zone where the machine resides.
- - -
* `post_startup_script` -
(Optional)
Path to a Bash script that automatically runs after a
notebook instance fully boots up. The path must be a URL
or Cloud Storage path (gs://path-to-file/file-name).
* `instance_owners` -
(Optional)
The list of owners of this instance after creation.
Format: alias@example.com.
Currently supports one owner only.
If not specified, all of the service account users of
your VM instance's service account can use the instance.
* `service_account` -
(Optional)
The service account on this instance, giving access to other
Google Cloud services. You can use any service account within
the same project, but you must have the service account user
permission to use the instance. If not specified,
the Compute Engine default service account is used.
* `service_account_scopes` -
(Optional)
Optional. The URIs of service account scopes to be included in Compute Engine instances.
If not specified, the following scopes are defined:
- https://www.googleapis.com/auth/cloud-platform
- https://www.googleapis.com/auth/userinfo.email
* `accelerator_config` -
(Optional)
The hardware accelerator used on this instance. If you use accelerators,
make sure that your configuration has enough vCPUs and memory to support the
machineType you have selected.
Structure is [documented below](#nested_accelerator_config).
* `shielded_instance_config` -
(Optional)
A set of Shielded Instance options. Check [Images using supported Shielded VM features]
Not all combinations are valid
Structure is [documented below](#nested_shielded_instance_config).
* `nic_type` -
(Optional)
The type of vNIC driver.
Possible values are: `UNSPECIFIED_NIC_TYPE`, `VIRTIO_NET`, `GVNIC`.
* `reservation_affinity` -
(Optional)
Reservation Affinity for consuming Zonal reservation.
Structure is [documented below](#nested_reservation_affinity).
* `install_gpu_driver` -
(Optional)
Whether the end user authorizes Google Cloud to install GPU driver
on this instance. If this field is empty or set to false, the GPU driver
won't be installed. Only applicable to instances with GPUs.
* `custom_gpu_driver_path` -
(Optional)
Specify a custom Cloud Storage path where the GPU driver is stored.
If not specified, we'll automatically choose from official GPU drivers.
* `boot_disk_type` -
(Optional)
Possible disk types for notebook instances.
Possible values are: `DISK_TYPE_UNSPECIFIED`, `PD_STANDARD`, `PD_SSD`, `PD_BALANCED`, `PD_EXTREME`.
* `boot_disk_size_gb` -
(Optional)
The size of the boot disk in GB attached to this instance,
up to a maximum of 64000 GB (64 TB). The minimum recommended value is 100 GB.
If not specified, this defaults to 100.
* `data_disk_type` -
(Optional)
Possible disk types for notebook instances.
Possible values are: `DISK_TYPE_UNSPECIFIED`, `PD_STANDARD`, `PD_SSD`, `PD_BALANCED`, `PD_EXTREME`.
* `data_disk_size_gb` -
(Optional)
The size of the data disk in GB attached to this instance,
up to a maximum of 64000 GB (64 TB).
You can choose the size of the data disk based on how big your notebooks and data are.
If not specified, this defaults to 100.
* `no_remove_data_disk` -
(Optional)
If true, the data disk will not be auto deleted when deleting the instance.
* `disk_encryption` -
(Optional)
Disk encryption method used on the boot and data disks, defaults to GMEK.
Possible values are: `DISK_ENCRYPTION_UNSPECIFIED`, `GMEK`, `CMEK`.
* `kms_key` -
(Optional)
The KMS key used to encrypt the disks, only applicable if diskEncryption is CMEK.
Format: projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}
* `no_public_ip` -
(Optional)
No public IP will be assigned to this instance.
* `no_proxy_access` -
(Optional)
The notebook instance will not register with the proxy..
* `network` -
(Optional)
The name of the VPC that this instance is in.
Format: projects/{project_id}/global/networks/{network_id}
* `subnet` -
(Optional)
The name of the subnet that this instance is in.
Format: projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}
* `labels` -
(Optional)
Labels to apply to this instance. These can be later modified by the setLabels method.
An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
**Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
Please refer to the field `effective_labels` for all of the labels present on the resource.
* `tags` -
(Optional)
The Compute Engine tags to add to instance.
* `metadata` -
(Optional)
Custom metadata to apply to this instance.
An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
* `vm_image` -
(Optional)
Use a Compute Engine VM image to start the notebook instance.
Structure is [documented below](#nested_vm_image).
* `container_image` -
(Optional)
Use a container image to start the notebook instance.
Structure is [documented below](#nested_container_image).
* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
* `desired_state` - (Optional) Desired state of the Notebook Instance. Set this field to `ACTIVE` to start the Instance, and `STOPPED` to stop the Instance.
<a name="nested_accelerator_config"></a>The `accelerator_config` block supports:
* `type` -
(Required)
Type of this accelerator.
Possible values are: `ACCELERATOR_TYPE_UNSPECIFIED`, `NVIDIA_TESLA_K80`, `NVIDIA_TESLA_P100`, `NVIDIA_TESLA_V100`, `NVIDIA_TESLA_P4`, `NVIDIA_TESLA_T4`, `NVIDIA_TESLA_T4_VWS`, `NVIDIA_TESLA_P100_VWS`, `NVIDIA_TESLA_P4_VWS`, `NVIDIA_TESLA_A100`, `TPU_V2`, `TPU_V3`.
* `core_count` -
(Required)
Count of cores of this accelerator.
<a name="nested_shielded_instance_config"></a>The `shielded_instance_config` block supports:
* `enable_integrity_monitoring` -
(Optional)
Defines whether the instance has integrity monitoring enabled. Enables monitoring and attestation of the
boot integrity of the instance. The attestation is performed against the integrity policy baseline.
This baseline is initially derived from the implicitly trusted boot image when the instance is created.
Enabled by default.
* `enable_secure_boot` -
(Optional)
Defines whether the instance has Secure Boot enabled. Secure Boot helps ensure that the system only runs
authentic software by verifying the digital signature of all boot components, and halting the boot process
if signature verification fails.
Disabled by default.
* `enable_vtpm` -
(Optional)
Defines whether the instance has the vTPM enabled.
Enabled by default.
<a name="nested_reservation_affinity"></a>The `reservation_affinity` block supports:
* `consume_reservation_type` -
(Required)
The type of Compute Reservation.
Possible values are: `NO_RESERVATION`, `ANY_RESERVATION`, `SPECIFIC_RESERVATION`.
* `key` -
(Optional)
Corresponds to the label key of reservation resource.
* `values` -
(Optional)
Corresponds to the label values of reservation resource.
<a name="nested_vm_image"></a>The `vm_image` block supports:
* `project` -
(Required)
The name of the Google Cloud project that this VM image belongs to.
Format: projects/{project_id}
* `image_family` -
(Optional)
Use this VM image family to find the image; the newest image in this family will be used.
* `image_name` -
(Optional)
Use VM image name to find the image.
<a name="nested_container_image"></a>The `container_image` 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:
* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{location}}/instances/{{name}}`
* `proxy_uri` -
The proxy endpoint that is used to access the Jupyter notebook.
Only returned when the resource is in a `PROVISIONED` state. If
needed you can utilize `terraform apply -refresh-only` to await
the population of this value.
* `state` -
The state of this instance.
* `create_time` -
Instance creation time
* `update_time` -
Instance update time.
* `terraform_labels` -
The combination of labels configured directly on the resource
and default labels configured on the provider.
* `effective_labels` -
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
## Timeouts
This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
- `create` - Default is 20 minutes.
- `update` - Default is 20 minutes.
- `delete` - Default is 20 minutes.
## Import
Instance can be imported using any of these accepted formats:
* `projects/{{project}}/locations/{{location}}/instances/{{name}}`
* `{{project}}/{{location}}/{{name}}`
* `{{location}}/{{name}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Instance using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/locations/{{location}}/instances/{{name}}"
to = google_notebooks_instance.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Instance can be imported using one of the formats above. For example:
```
$ terraform import google_notebooks_instance.default projects/{{project}}/locations/{{location}}/instances/{{name}}
$ terraform import google_notebooks_instance.default {{project}}/{{location}}/{{name}}
$ terraform import google_notebooks_instance.default {{location}}/{{name}}
```
## User Project Overrides
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).