google_workbench_instance

A Workbench instance.

Open in Cloud Shell

Example Usage - Workbench Instance Basic

resource "google_workbench_instance" "instance" {
  name = "workbench-instance"
  location = "us-west1-a"
}
Open in Cloud Shell

Example Usage - Workbench Instance Basic Container

resource "google_workbench_instance" "instance" {
  name = "workbench-instance"
  location = "us-west1-a"

  gce_setup {
    container_image {
      repository = "us-docker.pkg.dev/deeplearning-platform-release/gcr.io/base-cu113.py310"
      tag = "latest"
    }
  }
}
Open in Cloud Shell

Example Usage - Workbench Instance Basic Gpu

resource "google_workbench_instance" "instance" {
  name = "workbench-instance"
  location = "us-central1-a"
  gce_setup {
    machine_type = "n1-standard-1" // cant be e2 because of accelerator
    accelerator_configs {
      type         = "NVIDIA_TESLA_T4"
      core_count   = 1
    }
    vm_image {
      project      = "cloud-notebooks-managed"
      family       = "workbench-instances"
    }
  }
}

Example Usage - Workbench Instance Labels Stopped

resource "google_workbench_instance" "instance" {
  name = "workbench-instance"
  location = "us-central1-a"

  gce_setup {
    machine_type = "e2-standard-4"

    shielded_instance_config {
      enable_secure_boot = false
      enable_vtpm = false
      enable_integrity_monitoring = false
    }

    service_accounts {
      email = "my@service-account.com"
    }

    metadata = {
      terraform = "true"
    }

  }

  instance_owners  = [ "my@service-account.com"]

  labels = {
    k = "val"
  }

  desired_state = "STOPPED"

}

Example Usage - Workbench Instance Full

resource "google_compute_network" "my_network" {
  name = "wbi-test-default"
  auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "my_subnetwork" {
  name   = "wbi-test-default"
  network = google_compute_network.my_network.id
  region = "us-central1"
  ip_cidr_range = "10.0.1.0/24"
}

resource "google_workbench_instance" "instance" {
  name = "workbench-instance"
  location = "us-central1-a"

  gce_setup {
    machine_type = "n1-standard-4" // cant be e2 because of accelerator
    accelerator_configs {
      type         = "NVIDIA_TESLA_T4"
      core_count   = 1
    }

    shielded_instance_config {
      enable_secure_boot = true
      enable_vtpm = true
      enable_integrity_monitoring = true
    }

    disable_public_ip = false

    service_accounts {
      email = "my@service-account.com"
    }

    boot_disk {
      disk_size_gb  = 310
      disk_type = "PD_SSD"
      disk_encryption = "CMEK"
      kms_key = "my-crypto-key"
    }

    data_disks {
      disk_size_gb  = 330
      disk_type = "PD_SSD"
      disk_encryption = "CMEK"
      kms_key = "my-crypto-key"
    }

    network_interfaces {
      network = google_compute_network.my_network.id
      subnet = google_compute_subnetwork.my_subnetwork.id
      nic_type = "GVNIC"
    }

    metadata = {
      terraform = "true"
    }

    enable_ip_forwarding = true

    tags = ["abc", "def"]

  }

  disable_proxy_access = "true"

  instance_owners  = [ "my@service-account.com"]

  labels = {
    k = "val"
  }

  desired_state = "ACTIVE"

}

Argument Reference

The following arguments are supported:


The gce_setup block supports:

The accelerator_configs block supports:

The shielded_instance_config block supports:

The service_accounts block supports:

The vm_image block supports:

The container_image block supports:

The boot_disk block supports:

The data_disks block supports:

The network_interfaces block supports:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

The upgrade_history block contains:

Timeouts

This resource provides the following Timeouts configuration options:

Import

Instance can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import Instance using one of the formats above. For example:

import {
  id = "projects/{{project}}/locations/{{location}}/instances/{{name}}"
  to = google_workbench_instance.default
}

When using the terraform import command, Instance can be imported using one of the formats above. For example:

$ terraform import google_workbench_instance.default projects/{{project}}/locations/{{location}}/instances/{{name}}
$ terraform import google_workbench_instance.default {{project}}/{{location}}/{{name}}
$ terraform import google_workbench_instance.default {{location}}/{{name}}

User Project Overrides

This resource supports User Project Overrides.