forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Beta support for allowedPorts field for Cloud Workstations config…
…urations (GoogleCloudPlatform#11299) Co-authored-by: Cameron Thornton <[email protected]>
- Loading branch information
Showing
3 changed files
with
243 additions
and
1 deletion.
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
62 changes: 62 additions & 0 deletions
62
mmv1/templates/terraform/examples/workstation_config_allowed_ports.tf.tmpl
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,62 @@ | ||
resource "google_compute_network" "default" { | ||
provider = google-beta | ||
name = "{{index $.Vars "workstation_cluster_name"}}" | ||
auto_create_subnetworks = false | ||
} | ||
|
||
resource "google_compute_subnetwork" "default" { | ||
provider = google-beta | ||
name = "{{index $.Vars "workstation_cluster_name"}}" | ||
ip_cidr_range = "10.0.0.0/24" | ||
region = "us-central1" | ||
network = google_compute_network.default.name | ||
} | ||
|
||
resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" { | ||
provider = google-beta | ||
workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" | ||
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" "{{$.PrimaryResourceId}}" { | ||
provider = google-beta | ||
workstation_config_id = "{{index $.Vars "workstation_config_name"}}" | ||
workstation_cluster_id = google_workstations_workstation_cluster.{{$.PrimaryResourceId}}.workstation_cluster_id | ||
location = "us-central1" | ||
|
||
host { | ||
gce_instance { | ||
machine_type = "e2-standard-4" | ||
boot_disk_size_gb = 35 | ||
disable_public_ip_addresses = true | ||
} | ||
} | ||
|
||
# Allow only port 80 (HTTP) | ||
allowed_ports { | ||
first = 80 | ||
last = 80 | ||
} | ||
|
||
# Allow only port 22 (SSH) | ||
allowed_ports { | ||
first = 22 | ||
last = 22 | ||
} | ||
|
||
# Allow port range 1024-65535 | ||
allowed_ports { | ||
first = 1024 | ||
last = 65535 | ||
} | ||
} |
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