diff --git a/mmv1/products/workbench/Instance.yaml b/mmv1/products/workbench/Instance.yaml index b139523ff190..fc778494475f 100644 --- a/mmv1/products/workbench/Instance.yaml +++ b/mmv1/products/workbench/Instance.yaml @@ -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 diff --git a/mmv1/templates/terraform/examples/workbench_instance_full.tf.erb b/mmv1/templates/terraform/examples/workbench_instance_full.tf.erb index dd1122901e18..8baa74f8d739 100644 --- a/mmv1/templates/terraform/examples/workbench_instance_full.tf.erb +++ b/mmv1/templates/terraform/examples/workbench_instance_full.tf.erb @@ -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" @@ -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 = {