Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workbench instances support for static external IP #10934

Merged
merged 11 commits into from
Jul 15, 2024
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
bcreddy-gcp marked this conversation as resolved.
Show resolved Hide resolved
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