Google Cloud AI Notebooks Instance
This page shows how to write Terraform for Cloud AI Notebooks Instance and write them securely.
google_notebooks_instance (Terraform)
The Instance in Cloud AI Notebooks can be configured in Terraform with the resource name google_notebooks_instance
. The following sections describe 3 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "google_notebooks_instance" "instance" {
name = "notebooks-instance"
location = "europe-west2-a"
machine_type = "e2-medium"
vm_image {
resource "google_notebooks_instance" "instance" {
provider = google-beta
name = var.name
location = var.zone
machine_type = var.machine_type
resource "google_notebooks_instance" "nb-glider-data-processing" {
name = "glider-data-processing"
machine_type = "n1-standard-1" #1, 2, 4, 8, 16, 32
location = var.zone
vm_image {
Parameters
-
boot_disk_size_gb
optional - number
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.
-
boot_disk_type
optional - string
Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED"]
-
create_time
optional computed - string
Instance creation time
-
custom_gpu_driver_path
optional - string
Specify a custom Cloud Storage path where the GPU driver is stored. If not specified, we'll automatically choose from official GPU drivers.
-
data_disk_size_gb
optional - number
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.
-
data_disk_type
optional - string
Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED"]
-
disk_encryption
optional - string
Disk encryption method used on the boot and data disks, defaults to GMEK. Possible values: ["DISK_ENCRYPTION_UNSPECIFIED", "GMEK", "CMEK"]
-
id
optional computed - string -
install_gpu_driver
optional - bool
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.
-
instance_owners
optional - list of string
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.
-
kms_key
optional - string
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]
-
labels
optional computed - map from string to string
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" ].
-
location
required - string
A reference to the zone where the machine resides.
-
machine_type
required - string
A reference to a machine type which defines VM kind.
-
metadata
optional - map from string to string
Custom metadata to apply to this instance. An object containing a list of "key": value pairs. Example: [ "name": "wrench", "mass": "1.3kg", "count": "3" ].
-
name
required - string
The name specified for the Notebook instance.
-
network
optional computed - string
The name of the VPC that this instance is in. Format: projects/[project_id]/global/networks/[network_id]
-
no_proxy_access
optional - bool
The notebook instance will not register with the proxy..
-
no_public_ip
optional - bool
No public IP will be assigned to this instance.
-
no_remove_data_disk
optional - bool
If true, the data disk will not be auto deleted when deleting the instance.
-
post_startup_script
optional - string
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).
The proxy endpoint that is used to access the Jupyter notebook.
-
service_account
optional computed - string
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 - list of string
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
-
state
optional computed - string
The state of this instance.
-
subnet
optional computed - string
The name of the subnet that this instance is in. Format: projects/[project_id]/regions/[region]/subnetworks/[subnetwork_id]
-
tags
optional - list of string
The Compute Engine tags to add to runtime.
-
update_time
optional computed - string
Instance update time.
-
accelerator_config
list block-
core_count
required - number
Count of cores of this accelerator.
-
type
required - string
Type of this accelerator. Possible values: ["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"]
-
-
container_image
list block-
repository
required - string
The path to the container image repository. For example: gcr.io/[project_id]/[imageName]
-
tag
optional - string
The tag of the container image. If not specified, this defaults to the latest tag.
-
-
shielded_instance_config
list block-
enable_integrity_monitoring
optional - bool
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 - bool
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 - bool
Defines whether the instance has the vTPM enabled. Enabled by default.
-
-
timeouts
single block -
vm_image
list block-
image_family
optional - string
Use this VM image family to find the image; the newest image in this family will be used.
-
image_name
optional - string
Use VM image name to find the image.
-
project
required - string
The name of the Google Cloud project that this VM image belongs to. Format: projects/[project_id]
-
Explanation in Terraform Registry
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
- How-to Guides
Frequently asked questions
What is Google Cloud AI Notebooks Instance?
Google Cloud AI Notebooks Instance is a resource for Cloud AI Notebooks of Google Cloud Platform. Settings can be wrote in Terraform.
Where can I find the example code for the Google Cloud AI Notebooks Instance?
For Terraform, the mabel-dev/infrastructure, marcelopicarelli/google-datalake and us-amlr/amlr-gcp-terraform source code examples are useful. See the Terraform Example section for further details.