|
| 1 | +--- |
| 2 | +# ---------------------------------------------------------------------------- |
| 3 | +# |
| 4 | +# *** AUTO GENERATED CODE *** Type: MMv1 *** |
| 5 | +# |
| 6 | +# ---------------------------------------------------------------------------- |
| 7 | +# |
| 8 | +# This file is automatically generated by Magic Modules and manual |
| 9 | +# changes will be clobbered when the file is regenerated. |
| 10 | +# |
| 11 | +# Please read more about how to change this file in |
| 12 | +# .github/CONTRIBUTING.md. |
| 13 | +# |
| 14 | +# ---------------------------------------------------------------------------- |
| 15 | +subcategory: "Workstations" |
| 16 | +description: |- |
| 17 | + A single instance of a developer workstation with its own persistent storage. |
| 18 | +--- |
| 19 | + |
| 20 | +# google\_workstations\_workstation |
| 21 | + |
| 22 | +A single instance of a developer workstation with its own persistent storage. |
| 23 | + |
| 24 | +~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. |
| 25 | +See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. |
| 26 | + |
| 27 | +To get more information about Workstation, see: |
| 28 | + |
| 29 | +* [API documentation](https://cloud.google.com/workstations/docs/reference/rest/v1beta/projects.locations.workstationClusters.workstationConfigs.workstations) |
| 30 | +* How-to Guides |
| 31 | + * [Workstations](https://cloud.google.com/workstations/docs/) |
| 32 | + |
| 33 | +<div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| 34 | + <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.jpy.wang%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=workstation_basic&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank"> |
| 35 | + <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| 36 | + </a> |
| 37 | +</div> |
| 38 | +## Example Usage - Workstation Basic |
| 39 | + |
| 40 | + |
| 41 | +```hcl |
| 42 | +resource "google_compute_network" "default" { |
| 43 | + provider = google-beta |
| 44 | + name = "workstation-cluster" |
| 45 | + auto_create_subnetworks = false |
| 46 | +} |
| 47 | +
|
| 48 | +resource "google_compute_subnetwork" "default" { |
| 49 | + provider = google-beta |
| 50 | + name = "workstation-cluster" |
| 51 | + ip_cidr_range = "10.0.0.0/24" |
| 52 | + region = "us-central1" |
| 53 | + network = google_compute_network.default.name |
| 54 | +} |
| 55 | +
|
| 56 | +resource "google_workstations_workstation_cluster" "default" { |
| 57 | + provider = google-beta |
| 58 | + workstation_cluster_id = "workstation-cluster" |
| 59 | + network = google_compute_network.default.id |
| 60 | + subnetwork = google_compute_subnetwork.default.id |
| 61 | + location = "us-central1" |
| 62 | + |
| 63 | + labels = { |
| 64 | + "label" = "key" |
| 65 | + } |
| 66 | +
|
| 67 | + annotations = { |
| 68 | + label-one = "value-one" |
| 69 | + } |
| 70 | +} |
| 71 | +
|
| 72 | +resource "google_workstations_workstation_config" "default" { |
| 73 | + provider = google-beta |
| 74 | + workstation_config_id = "workstation-config" |
| 75 | + workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id |
| 76 | + location = "us-central1" |
| 77 | + |
| 78 | + host { |
| 79 | + gce_instance { |
| 80 | + machine_type = "e2-standard-4" |
| 81 | + boot_disk_size_gb = 35 |
| 82 | + disable_public_ip_addresses = true |
| 83 | + } |
| 84 | + } |
| 85 | +} |
| 86 | +
|
| 87 | +resource "google_workstations_workstation" "default" { |
| 88 | + provider = google-beta |
| 89 | + workstation_id = "workstation" |
| 90 | + workstation_config_id = google_workstations_workstation_config.default.workstation_config_id |
| 91 | + workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id |
| 92 | + location = "us-central1" |
| 93 | +
|
| 94 | + labels = { |
| 95 | + "label" = "key" |
| 96 | + } |
| 97 | +
|
| 98 | + annotations = { |
| 99 | + label-one = "value-one" |
| 100 | + } |
| 101 | +} |
| 102 | +``` |
| 103 | + |
| 104 | +## Argument Reference |
| 105 | + |
| 106 | +The following arguments are supported: |
| 107 | + |
| 108 | + |
| 109 | +* `workstation_id` - |
| 110 | + (Required) |
| 111 | + ID to use for the workstation. |
| 112 | + |
| 113 | +* `workstation_config_id` - |
| 114 | + (Required) |
| 115 | + The ID of the workstation cluster config. |
| 116 | + |
| 117 | +* `workstation_cluster_id` - |
| 118 | + (Required) |
| 119 | + The name of the workstation cluster. |
| 120 | + |
| 121 | +* `location` - |
| 122 | + (Required) |
| 123 | + The location where the workstation cluster config should reside. |
| 124 | + |
| 125 | + |
| 126 | +- - - |
| 127 | + |
| 128 | + |
| 129 | +* `display_name` - |
| 130 | + (Optional) |
| 131 | + Human-readable name for this resource. |
| 132 | + |
| 133 | +* `labels` - |
| 134 | + (Optional) |
| 135 | + Client-specified labels that are applied to the resource and that are also propagated to the underlying Compute Engine resources. |
| 136 | + |
| 137 | +* `annotations` - |
| 138 | + (Optional) |
| 139 | + Client-specified annotations. This is distinct from labels. |
| 140 | + |
| 141 | +* `project` - (Optional) The ID of the project in which the resource belongs. |
| 142 | + If it is not provided, the provider project is used. |
| 143 | + |
| 144 | + |
| 145 | +## Attributes Reference |
| 146 | + |
| 147 | +In addition to the arguments listed above, the following computed attributes are exported: |
| 148 | + |
| 149 | +* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{location}}/workstationClusters/{{workstation_cluster_id}}/workstationConfigs/{{workstation_config_id}}/workstations/{{workstation_id}}` |
| 150 | + |
| 151 | +* `name` - |
| 152 | + The name of the cluster resource. |
| 153 | + |
| 154 | +* `uid` - |
| 155 | + The system-generated UID of the resource. |
| 156 | + |
| 157 | +* `create_time` - |
| 158 | + Time the Instance was created in UTC. |
| 159 | + |
| 160 | +* `host` - |
| 161 | + Host to which clients can send HTTPS traffic that will be received by the workstation. |
| 162 | + Authorized traffic will be received to the workstation as HTTP on port 80. |
| 163 | + To send traffic to a different port, clients may prefix the host with the destination port in the format "{port}-{host}". |
| 164 | + |
| 165 | +* `state` - |
| 166 | + Current state of the workstation. |
| 167 | + |
| 168 | + |
| 169 | +## Timeouts |
| 170 | + |
| 171 | +This resource provides the following |
| 172 | +[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: |
| 173 | + |
| 174 | +- `create` - Default is 30 minutes. |
| 175 | +- `update` - Default is 30 minutes. |
| 176 | +- `delete` - Default is 30 minutes. |
| 177 | + |
| 178 | +## Import |
| 179 | + |
| 180 | + |
| 181 | +Workstation can be imported using any of these accepted formats: |
| 182 | + |
| 183 | +``` |
| 184 | +$ terraform import google_workstations_workstation.default projects/{{project}}/locations/{{location}}/workstationClusters/{{workstation_cluster_id}}/workstationConfigs/{{workstation_config_id}}/workstations/{{workstation_id}} |
| 185 | +$ terraform import google_workstations_workstation.default {{project}}/{{location}}/{{workstation_cluster_id}}/{{workstation_config_id}}/{{workstation_id}} |
| 186 | +$ terraform import google_workstations_workstation.default {{location}}/{{workstation_cluster_id}}/{{workstation_config_id}}/{{workstation_id}} |
| 187 | +``` |
| 188 | + |
| 189 | +## User Project Overrides |
| 190 | + |
| 191 | +This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |
0 commit comments