Skip to content

Commit

Permalink
workbench instances support for static external IP (GoogleCloudPlatfo…
Browse files Browse the repository at this point in the history
  • Loading branch information
bcreddy-gcp authored and Charlesleonius committed Aug 1, 2024
1 parent 60ac533 commit f9cfdac
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions mmv1/products/workbench/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,27 @@ properties:
values:
- VIRTIO_NET
- GVNIC
- !ruby/object:Api::Type::Array
name: accessConfigs
immutable: true
default_from_api: true
description: |
Optional. An array of configurations for this interface. Currently, only one access
config, ONE_TO_ONE_NAT, is supported. If no accessConfigs specified, the
instance will have an external internet access through an ephemeral
external IP address.
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::String
name: externalIp
immutable: true
required: true
description: |
An external IP address associated with this instance. Specify an unused
static external IP address available to the project or leave this field
undefined to use an IP from a shared ephemeral IP address pool. If you
specify a static external IP address, it must live in the same region as
the zone of the instance.
description: Optional. The network interfaces for the VM. Supports only one interface.
- !ruby/object:Api::Type::Boolean
name: disablePublicIp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ resource "google_compute_subnetwork" "my_subnetwork" {
ip_cidr_range = "10.0.1.0/24"
}

resource "google_compute_address" "static" {
name = "<%= ctx[:vars]['network_name'] %>"
}

resource "google_workbench_instance" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['instance_name'] %>"
location = "us-central1-a"
Expand Down Expand Up @@ -51,6 +55,9 @@ resource "google_workbench_instance" "<%= ctx[:primary_resource_id] %>" {
network = google_compute_network.my_network.id
subnet = google_compute_subnetwork.my_subnetwork.id
nic_type = "GVNIC"
access_configs {
external_ip = google_compute_address.static.address
}
}

metadata = {
Expand Down

0 comments on commit f9cfdac

Please sign in to comment.