google_workstations_workstation_config

A set of configuration options describing how a workstation will be run. Workstation configurations are intended to be shared across multiple workstations.

To get more information about WorkstationConfig, see:

Open in Cloud Shell

Example Usage - Workstation Config Basic

resource "google_compute_network" "default" {
  provider                = google-beta
  name                    = "workstation-cluster"
  auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "default" {
  provider      = google-beta
  name          = "workstation-cluster"
  ip_cidr_range = "10.0.0.0/24"
  region        = "us-central1"
  network       = google_compute_network.default.name
}

resource "google_workstations_workstation_cluster" "default" {
  provider               = google-beta
  workstation_cluster_id = "workstation-cluster"
  network                = google_compute_network.default.id
  subnetwork             = google_compute_subnetwork.default.id
  location               = "us-central1"

  labels = {
    "label" = "key"
  }

  annotations = {
    label-one = "value-one"
  }
}

resource "google_workstations_workstation_config" "default" {
  provider               = google-beta
  workstation_config_id  = "workstation-config"
  workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id
  location                   = "us-central1"

  idle_timeout = "600s"
  running_timeout = "21600s"

  replica_zones = ["us-central1-a", "us-central1-b"]
  annotations = {
    label-one = "value-one"
  }

  labels = {
    "label" = "key"
  }

  host {
    gce_instance {
      machine_type                = "e2-standard-4"
      boot_disk_size_gb           = 35
      disable_public_ip_addresses = true
      disable_ssh                 = false
    }
  }
}
Open in Cloud Shell

Example Usage - Workstation Config Container

resource "google_compute_network" "default" {
  provider                = google-beta
  name                    = "workstation-cluster"
  auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "default" {
  provider      = google-beta
  name          = "workstation-cluster"
  ip_cidr_range = "10.0.0.0/24"
  region        = "us-central1"
  network       = google_compute_network.default.name
}

resource "google_workstations_workstation_cluster" "default" {
  provider               = google-beta
  workstation_cluster_id = "workstation-cluster"
  network                = google_compute_network.default.id
  subnetwork             = google_compute_subnetwork.default.id
  location               = "us-central1"

  labels = {
    "label" = "key"
  }

  annotations = {
    label-one = "value-one"
  }
}

resource "google_workstations_workstation_config" "default" {
  provider               = google-beta
  workstation_config_id  = "workstation-config"
  workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id
  location                   = "us-central1"

  host {
    gce_instance {
      machine_type                 = "n1-standard-4"
      boot_disk_size_gb            = 35
      disable_public_ip_addresses  = true
      enable_nested_virtualization = true
    }
  }

  container {
    image = "intellij"
    env = {
      NAME = "FOO"
      BABE = "bar"
    }
  }
}
Open in Cloud Shell

Example Usage - Workstation Config Persistent Directories

resource "google_compute_network" "default" {
  provider                = google-beta
  name                    = "workstation-cluster"
  auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "default" {
  provider      = google-beta
  name          = "workstation-cluster"
  ip_cidr_range = "10.0.0.0/24"
  region        = "us-central1"
  network       = google_compute_network.default.name
}

resource "google_workstations_workstation_cluster" "default" {
  provider               = google-beta
  workstation_cluster_id = "workstation-cluster"
  network                = google_compute_network.default.id
  subnetwork             = google_compute_subnetwork.default.id
  location               = "us-central1"

  labels = {
    "label" = "key"
  }

  annotations = {
    label-one = "value-one"
  }
}

resource "google_workstations_workstation_config" "default" {
  provider               = google-beta
  workstation_config_id  = "workstation-config"
  workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id
  location                   = "us-central1"

  host {
    gce_instance {
      machine_type                = "e2-standard-4"
      boot_disk_size_gb           = 35
      disable_public_ip_addresses = true
      shielded_instance_config {
        enable_secure_boot = true
        enable_vtpm        = true
      }
    }
  }

  persistent_directories {
    mount_path = "/home"
    gce_pd {
      size_gb        = 200
      fs_type        = "ext4"
      disk_type      = "pd-standard"
      reclaim_policy = "DELETE"
    }
  }
}
Open in Cloud Shell

Example Usage - Workstation Config Source Snapshot

resource "google_compute_network" "default" {
  provider                = google-beta
  name                    = "workstation-cluster"
  auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "default" {
  provider      = google-beta
  name          = "workstation-cluster"
  ip_cidr_range = "10.0.0.0/24"
  region        = "us-central1"
  network       = google_compute_network.default.name
}

resource "google_compute_disk" "my_source_disk" {
  provider = google-beta
  name     = "workstation-config"
  size     = 10
  type     = "pd-ssd"
  zone     = "us-central1-a"
}

resource "google_compute_snapshot" "my_source_snapshot" {
  provider    = google-beta
  name        = "workstation-config"
  source_disk = google_compute_disk.my_source_disk.name
  zone        = "us-central1-a"
}

resource "google_workstations_workstation_cluster" "default" {
  provider               = google-beta
  workstation_cluster_id = "workstation-cluster"
  network                = google_compute_network.default.id
  subnetwork             = google_compute_subnetwork.default.id
  location               = "us-central1"
}

resource "google_workstations_workstation_config" "default" {
  provider               = google-beta
  workstation_config_id  = "workstation-config"
  workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id
  location               = google_workstations_workstation_cluster.default.location

  persistent_directories {
    mount_path = "/home"

    gce_pd {
      source_snapshot = google_compute_snapshot.my_source_snapshot.id
      reclaim_policy  = "DELETE"
    }
  }
}
Open in Cloud Shell

Example Usage - Workstation Config Shielded Instance Config

resource "google_compute_network" "default" {
  provider                = google-beta
  name                    = "workstation-cluster"
  auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "default" {
  provider      = google-beta
  name          = "workstation-cluster"
  ip_cidr_range = "10.0.0.0/24"
  region        = "us-central1"
  network       = google_compute_network.default.name
}

resource "google_workstations_workstation_cluster" "default" {
  provider               = google-beta
  workstation_cluster_id = "workstation-cluster"
  network                = google_compute_network.default.id
  subnetwork             = google_compute_subnetwork.default.id
  location               = "us-central1"

  labels = {
    "label" = "key"
  }

  annotations = {
    label-one = "value-one"
  }
}

resource "google_workstations_workstation_config" "default" {
  provider               = google-beta
  workstation_config_id  = "workstation-config"
  workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id
  location                   = "us-central1"

  host {
    gce_instance {
      machine_type                = "e2-standard-4"
      boot_disk_size_gb           = 35
      disable_public_ip_addresses = true
      shielded_instance_config {
        enable_secure_boot = true
        enable_vtpm        = true
      }
    }
  }
}
Open in Cloud Shell

Example Usage - Workstation Config Accelerators

resource "google_compute_network" "default" {
  provider                = google-beta
  name                    = "workstation-cluster"
  auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "default" {
  provider      = google-beta
  name          = "workstation-cluster"
  ip_cidr_range = "10.0.0.0/24"
  region        = "us-central1"
  network       = google_compute_network.default.name
}

resource "google_workstations_workstation_cluster" "default" {
  provider               = google-beta
  workstation_cluster_id = "workstation-cluster"
  network                = google_compute_network.default.id
  subnetwork             = google_compute_subnetwork.default.id
  location               = "us-central1"

  labels = {
    "label" = "key"
  }

  annotations = {
    label-one = "value-one"
  }
}

resource "google_workstations_workstation_config" "default" {
  provider               = google-beta
  workstation_config_id  = "workstation-config"
  workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id
  location               = "us-central1"

  host {
    gce_instance {
      machine_type                = "n1-standard-2"
      boot_disk_size_gb           = 35
      disable_public_ip_addresses = true
      accelerators {
        type  = "nvidia-tesla-t4"
        count = "1"
      }
    }
  }
}
Open in Cloud Shell

Example Usage - Workstation Config Boost

resource "google_compute_network" "default" {
  provider                = google-beta
  name                    = "workstation-cluster"
  auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "default" {
  provider      = google-beta
  name          = "workstation-cluster"
  ip_cidr_range = "10.0.0.0/24"
  region        = "us-central1"
  network       = google_compute_network.default.name
}

resource "google_workstations_workstation_cluster" "default" {
  provider               = google-beta
  workstation_cluster_id = "workstation-cluster"
  network                = google_compute_network.default.id
  subnetwork             = google_compute_subnetwork.default.id
  location               = "us-central1"

  labels = {
    "label" = "key"
  }

  annotations = {
    label-one = "value-one"
  }
}

resource "google_workstations_workstation_config" "default" {
  provider               = google-beta
  workstation_config_id  = "workstation-config"
  workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id
  location               = "us-central1"

  host {
    gce_instance {
      machine_type                = "e2-standard-4"
      boot_disk_size_gb           = 35
      disable_public_ip_addresses = true
      boost_configs {
        id           = "boost-1"
        machine_type = "n1-standard-2"
        accelerators {
          type  = "nvidia-tesla-t4"
          count = "1"
        }
      }
      boost_configs {
        id           = "boost-1"
        machine_type = "e2-standard-2"
      }
    }
  }
}
Open in Cloud Shell

Example Usage - Workstation Config Encryption Key

resource "google_compute_network" "default" {
  provider = google-beta

  name                    = "workstation-cluster"
  auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "default" {
  provider = google-beta

  name          = "workstation-cluster"
  ip_cidr_range = "10.0.0.0/24"
  region        = "us-central1"
  network       = google_compute_network.default.name
}

resource "google_workstations_workstation_cluster" "default" {
  provider = google-beta

  workstation_cluster_id = "workstation-cluster"
  network                = google_compute_network.default.id
  subnetwork             = google_compute_subnetwork.default.id
  location               = "us-central1"

  labels = {
    "label" = "key"
  }

  annotations = {
    label-one = "value-one"
  }
}

resource "google_kms_key_ring" "default" {
  provider = google-beta

  name     = "workstation-cluster"
  location = "us-central1"
}

resource "google_kms_crypto_key" "default" {
  provider = google-beta

  name            = "workstation-cluster"
  key_ring        = google_kms_key_ring.default.id
}

resource "google_service_account" "default" {
  provider = google-beta

  account_id   = "my-account"
  display_name = "Service Account"
}

resource "google_workstations_workstation_config" "default" {
  provider               = google-beta

  workstation_config_id  = "workstation-config"
  workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id
  location                   = "us-central1"

  host {
    gce_instance {
      machine_type                = "e2-standard-4"
      boot_disk_size_gb           = 35
      disable_public_ip_addresses = true
      shielded_instance_config {
        enable_secure_boot = true
        enable_vtpm        = true
      }
    }
  }

  encryption_key {
    kms_key                 = google_kms_crypto_key.default.id
    kms_key_service_account = google_service_account.default.email
  }
}

Argument Reference

The following arguments are supported:


The host block supports:

The gce_instance block supports:

The shielded_instance_config block supports:

The confidential_instance_config block supports:

The accelerators block supports:

The boost_configs block supports:

The accelerators block supports:

The persistent_directories block supports:

The gce_pd block supports:

The ephemeral_directories block supports:

The gce_pd block supports:

The container block supports:

The encryption_key block supports:

The readiness_checks block supports:

Attributes Reference

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

The conditions block contains:

Timeouts

This resource provides the following Timeouts configuration options:

Import

WorkstationConfig can be imported using any of these accepted formats:

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

import {
  id = "projects/{{project}}/locations/{{location}}/workstationClusters/{{workstation_cluster_id}}/workstationConfigs/{{workstation_config_id}}"
  to = google_workstations_workstation_config.default
}

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

$ terraform import google_workstations_workstation_config.default projects/{{project}}/locations/{{location}}/workstationClusters/{{workstation_cluster_id}}/workstationConfigs/{{workstation_config_id}}
$ terraform import google_workstations_workstation_config.default {{project}}/{{location}}/{{workstation_cluster_id}}/{{workstation_config_id}}
$ terraform import google_workstations_workstation_config.default {{location}}/{{workstation_cluster_id}}/{{workstation_config_id}}

User Project Overrides

This resource supports User Project Overrides.