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

enhance subnetwork resource with PRIVATE_NAT purpose in docs and test #8952

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion mmv1/products/compute/Subnetwork.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ examples:
vars:
subnetwork_name: 'internal-ipv6-test-subnetwork'
network_name: 'internal-ipv6-test-network'
- !ruby/object:Provider::Terraform::Examples
name: 'subnetwork_purpose_private_nat'
min_version: beta
primary_resource_id: 'subnetwork-purpose-private-nat'
vars:
subnetwork_name: 'subnet-purpose-test-subnetwork'
network_name: 'subnet-purpose-test-network'
properties:
- !ruby/object:Api::Type::Time
name: 'creationTimestamp'
Expand Down Expand Up @@ -165,10 +172,11 @@ properties:
name: 'purpose'
immutable: true
description: |
The purpose of the resource. This field can be either `PRIVATE_RFC_1918`, `REGIONAL_MANAGED_PROXY`, `GLOBAL_MANAGED_PROXY`, or `PRIVATE_SERVICE_CONNECT`.
The purpose of the resource. This field can be either `PRIVATE_RFC_1918`, `REGIONAL_MANAGED_PROXY`, `GLOBAL_MANAGED_PROXY`, `PRIVATE_SERVICE_CONNECT` or `PRIVATE_NAT`([Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
A subnet with purpose set to `REGIONAL_MANAGED_PROXY` is a user-created subnetwork that is reserved for regional Envoy-based load balancers.
A subnetwork in a given region with purpose set to `GLOBAL_MANAGED_PROXY` is a proxy-only subnet and is shared between all the cross-regional Envoy-based load balancers.
A subnetwork with purpose set to `PRIVATE_SERVICE_CONNECT` reserves the subnet for hosting a Private Service Connect published service.
A subnetwork with purpose set to `PRIVATE_NAT` is used as source range for Private NAT gateways.
Note that `REGIONAL_MANAGED_PROXY` is the preferred setting for all regional Envoy load balancers.
If unspecified, the purpose defaults to `PRIVATE_RFC_1918`.
default_from_api: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
resource "google_compute_subnetwork" "subnetwork-purpose-private-nat" {
provider = google-beta

name = "<%= ctx[:vars]['subnetwork_name'] %>"
region = "us-west2"
ip_cidr_range = "192.168.1.0/24"
purpose = "PRIVATE_NAT"
network = google_compute_network.custom-test.id
}

resource "google_compute_network" "custom-test" {
provider = google-beta

name = "<%= ctx[:vars]['network_name'] %>"
auto_create_subnetworks = false
}