| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** 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 Workstations" |
| description: |- |
| A single instance of a developer workstation with its own persistent storage. |
| --- |
| |
| # google\_workstations\_workstation |
| |
| A single instance of a developer workstation with its own persistent storage. |
| |
| ~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. |
| See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. |
| |
| To get more information about Workstation, see: |
| |
| * [API documentation](https://cloud.google.com/workstations/docs/reference/rest/v1beta/projects.locations.workstationClusters.workstationConfigs.workstations) |
| * How-to Guides |
| * [Workstations](https://cloud.google.com/workstations/docs/) |
| |
| <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_working_dir=workstation_basic&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" 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 - Workstation Basic |
| |
| |
| ```hcl |
| 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 |
| } |
| } |
| } |
| |
| resource "google_workstations_workstation" "default" { |
| provider = google-beta |
| workstation_id = "work-station" |
| workstation_config_id = google_workstations_workstation_config.default.workstation_config_id |
| workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id |
| location = "us-central1" |
| |
| labels = { |
| "label" = "key" |
| } |
| |
| env = { |
| name = "foo" |
| } |
| |
| annotations = { |
| label-one = "value-one" |
| } |
| } |
| ``` |
| |
| ## Argument Reference |
| |
| The following arguments are supported: |
| |
| |
| * `workstation_id` - |
| (Required) |
| ID to use for the workstation. |
| |
| * `workstation_config_id` - |
| (Required) |
| The ID of the parent workstation cluster config. |
| |
| * `workstation_cluster_id` - |
| (Required) |
| The ID of the parent workstation cluster. |
| |
| * `location` - |
| (Required) |
| The location where the workstation parent resources reside. |
| |
| |
| - - - |
| |
| |
| * `display_name` - |
| (Optional) |
| Human-readable name for this resource. |
| |
| * `labels` - |
| (Optional) |
| Client-specified labels that are applied to the resource and that are also propagated to the underlying Compute Engine resources. |
| **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. |
| |
| * `annotations` - |
| (Optional) |
| Client-specified annotations. This is distinct from labels. |
| **Note**: This field is non-authoritative, and will only manage the annotations present in your configuration. |
| Please refer to the field `effective_annotations` for all of the annotations present on the resource. |
| |
| * `env` - |
| (Optional) |
| 'Client-specified environment variables passed to the workstation container's entrypoint.' |
| |
| * `project` - (Optional) The ID of the project in which the resource belongs. |
| If it is not provided, the provider project is used. |
| |
| |
| ## 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}}/workstationClusters/{{workstation_cluster_id}}/workstationConfigs/{{workstation_config_id}}/workstations/{{workstation_id}}` |
| |
| * `name` - |
| Full name of this resource. |
| |
| * `uid` - |
| A system-assigned unique identified for this resource. |
| |
| * `create_time` - |
| Time when this resource was created. |
| |
| * `host` - |
| Host to which clients can send HTTPS traffic that will be received by the workstation. |
| Authorized traffic will be received to the workstation as HTTP on port 80. |
| To send traffic to a different port, clients may prefix the host with the destination port in the format "{port}-{host}". |
| |
| * `state` - |
| Current state of the workstation. |
| |
| * `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. |
| |
| * `effective_annotations` - |
| All of annotations (key/value pairs) present on the resource in GCP, including the annotations 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 30 minutes. |
| - `update` - Default is 30 minutes. |
| - `delete` - Default is 30 minutes. |
| |
| ## Import |
| |
| |
| Workstation can be imported using any of these accepted formats: |
| |
| * `projects/{{project}}/locations/{{location}}/workstationClusters/{{workstation_cluster_id}}/workstationConfigs/{{workstation_config_id}}/workstations/{{workstation_id}}` |
| * `{{project}}/{{location}}/{{workstation_cluster_id}}/{{workstation_config_id}}/{{workstation_id}}` |
| * `{{location}}/{{workstation_cluster_id}}/{{workstation_config_id}}/{{workstation_id}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Workstation using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/locations/{{location}}/workstationClusters/{{workstation_cluster_id}}/workstationConfigs/{{workstation_config_id}}/workstations/{{workstation_id}}" |
| to = google_workstations_workstation.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Workstation can be imported using one of the formats above. For example: |
| |
| ``` |
| $ terraform import google_workstations_workstation.default projects/{{project}}/locations/{{location}}/workstationClusters/{{workstation_cluster_id}}/workstationConfigs/{{workstation_config_id}}/workstations/{{workstation_id}} |
| $ terraform import google_workstations_workstation.default {{project}}/{{location}}/{{workstation_cluster_id}}/{{workstation_config_id}}/{{workstation_id}} |
| $ terraform import google_workstations_workstation.default {{location}}/{{workstation_cluster_id}}/{{workstation_config_id}}/{{workstation_id}} |
| ``` |
| |
| ## User Project Overrides |
| |
| This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |