-
Notifications
You must be signed in to change notification settings - Fork 913
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
919 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
# Workstation cluster | ||
|
||
This module allows to create a workstation cluster with associated workstation configs and workstations. In addition to this it allows to set up IAM bindings for the workstation configs and the workstations. | ||
|
||
## Examples | ||
|
||
## Simple example | ||
```hcl | ||
module "workstation-cluster" { | ||
source = "./fabric/modules/workstation-cluster" | ||
project_id = var.project_id | ||
workstation_cluster_id = "my-workstation-cluster" | ||
location = var.region | ||
network = var.vpc.self_link | ||
subnetwork = var.subnet.self_link | ||
workstation_configs = { | ||
my-workstation-config = { | ||
workstations = { | ||
my-workstation = { | ||
labels = { | ||
team = "my-team" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
# tftest modules=1 resources=3 inventory=simple.yaml | ||
``` | ||
|
||
## Private Cluster | ||
```hcl | ||
module "workstation-cluster" { | ||
source = "./fabric/modules/workstation-cluster" | ||
project_id = var.project_id | ||
workstation_cluster_id = "my-workstation-cluster" | ||
location = var.region | ||
network = var.vpc.self_link | ||
subnetwork = var.subnet.self_link | ||
private_cluster_config = { | ||
enable_private_endpoint = true | ||
} | ||
workstation_configs = { | ||
my-workstation-config = { | ||
workstations = { | ||
my-workstation = { | ||
labels = { | ||
team = "my-team" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
# tftest modules=1 resources=3 inventory=private-cluster.yaml | ||
``` | ||
|
||
## Custom container | ||
|
||
```hcl | ||
module "workstation-cluster" { | ||
source = "./fabric/modules/workstation-cluster" | ||
project_id = var.project_id | ||
workstation_cluster_id = "my-workstation-cluster" | ||
location = var.region | ||
network = var.vpc.self_link | ||
subnetwork = var.subnet.self_link | ||
workstation_configs = { | ||
my-workstation-config = { | ||
container = { | ||
image = "repo/my-image:v10.0.0" | ||
args = ["--arg1", "value1", "--arg2", "value2"] | ||
env = { | ||
VAR1 = "VALUE1" | ||
VAR2 = "VALUE2" | ||
} | ||
working_dir = "/my-dir" | ||
} | ||
workstations = { | ||
my-workstation = { | ||
labels = { | ||
team = "my-team" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
# tftest modules=1 resources=3 inventory=custom-container.yaml | ||
``` | ||
|
||
## IAM | ||
|
||
```hcl | ||
module "workstation-cluster" { | ||
source = "./fabric/modules/workstation-cluster" | ||
project_id = var.project_id | ||
workstation_cluster_id = "my-workstation-cluster" | ||
location = var.region | ||
network = var.vpc.self_link | ||
subnetwork = var.subnet.self_link | ||
workstation_configs = { | ||
my-workstation-config = { | ||
workstations = { | ||
my-workstation = { | ||
labels = { | ||
team = "my-team" | ||
} | ||
iam = { | ||
"roles/workstations.user" = ["user:[email protected]"] | ||
} | ||
} | ||
} | ||
iam = { | ||
"roles/viewer" = ["group:[email protected]"] | ||
} | ||
iam_bindings = { | ||
workstations-config-viewer = { | ||
role = "roles/viewer" | ||
members = ["group:[email protected]"] | ||
condition = { | ||
title = "limited-access" | ||
expression = "resource.name.startsWith('my-')" | ||
} | ||
} | ||
} | ||
iam_bindings_additive = { | ||
workstations-config-editor = { | ||
role = "roles/editor" | ||
member = "group:[email protected]" | ||
condition = { | ||
title = "limited-access" | ||
expression = "resource.name.startsWith('my-')" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
# tftest modules=1 resources=7 inventory=iam.yaml | ||
``` | ||
<!-- BEGIN TFDOC --> | ||
## Variables | ||
|
||
| name | description | type | required | default | | ||
|---|---|:---:|:---:|:---:| | ||
| [network](variables.tf#L47) | Network ID. | <code>string</code> | ✓ | | | ||
| [project_id](variables.tf#L62) | Cluster ID. | <code>string</code> | ✓ | | | ||
| [subnetwork](variables.tf#L67) | Subnet ID. | <code>string</code> | ✓ | | | ||
| [workstation_cluster_id](variables.tf#L72) | Workstation cluster ID. | <code>string</code> | ✓ | | | ||
| [workstation_configs](variables.tf#L77) | Workstation configurations. | <code title="map(object({ annotations = optional(map(string)) container = optional(object({ image = optional(string) command = optional(list(string), []) args = optional(list(string), []) working_dir = optional(string) env = optional(map(string), {}) run_as_user = optional(string) })) display_name = optional(string) enable_audit_agent = optional(bool) encryption_key = optional(object({ kms_key = string kms_key_service_account = string })) gce_instance = optional(object({ machine_type = optional(string) service_account = optional(string) service_account_scopes = optional(list(string), []) pool_size = optional(number) boot_disk_size_gb = optional(number) tags = optional(list(string)) disable_public_ip_addresses = optional(bool, false) enable_nested_virtualization = optional(bool, false) shielded_instance_config = optional(object({ enable_secure_boot = optional(bool, false) enable_vtpm = optional(bool, false) enable_integrity_monitoring = optional(bool, false) })) enable_confidential_compute = optional(bool, false) accelerators = optional(list(object({ type = optional(string) count = optional(number) })), []) })) iam = optional(map(list(string)), {}) iam_bindings = optional(map(object({ role = string members = list(string) })), {}) iam_bindings_additive = optional(map(object({ role = string member = string })), {}) idle_timeout = optional(string) labels = optional(map(string)) persistent_directories = optional(list(object({ mount_path = optional(string) gce_pd = optional(object({ size_gb = optional(number) fs_type = optional(string) disk_type = optional(string) source_snapshot = optional(string) reclaim_policy = optional(string) })) })), []) running_timeout = optional(string) replica_zones = optional(list(string)) workstations = optional(map(object({ annotations = optional(map(string)) display_name = optional(string) env = optional(map(string)) iam = optional(map(list(string)), {}) iam_bindings = optional(map(object({ role = string members = list(string) })), {}) iam_bindings_additive = optional(map(object({ role = string member = string })), {}) labels = optional(map(string)) })), {}) }))">map(object({…}))</code> | ✓ | | | ||
| [annotations](variables.tf#L17) | Annotations. | <code>map(string)</code> | | <code>{}</code> | | ||
| [display_name](variables.tf#L23) | Display name. | <code>string</code> | | <code>null</code> | | ||
| [domain](variables.tf#L29) | Domain. | <code>string</code> | | <code>null</code> | | ||
| [labels](variables.tf#L35) | Labels. | <code>map(string)</code> | | <code>{}</code> | | ||
| [location](variables.tf#L41) | Location. | <code>string</code> | | <code>null</code> | | ||
| [private_cluster_config](variables.tf#L52) | Private cluster config. | <code title="object({ enable_private_endpoint = optional(bool, false) allowed_projects = optional(list(string)) })">object({…})</code> | | <code>{}</code> | | ||
<!-- END TFDOC --> |
Oops, something went wrong.