diff --git a/products/compute/api.yaml b/products/compute/api.yaml index c32654467044..6c9f04075534 100644 --- a/products/compute/api.yaml +++ b/products/compute/api.yaml @@ -6408,6 +6408,18 @@ objects: output: true description: | URL to a Network that should handle matching packets. + - !ruby/object:Api::Type::ResourceRef + name: 'nextHopIlb' + resource: 'ForwardingRule' + imports: 'selfLink' + description: | + The URL to a forwarding rule of type loadBalancingScheme=INTERNAL that should handle matching packets. + You can only specify the forwarding rule as a partial or full URL. For example, the following are all valid URLs: + https://www.googleapis.com/compute/v1/projects/project/regions/region/forwardingRules/forwardingRule + regions/region/forwardingRules/forwardingRule + Note that this can only be used when the destinationRange is a public (non-RFC 1918) IP CIDR range. + input: true + min_version: beta - !ruby/object:Api::Resource name: 'Router' kind: 'compute#router' diff --git a/products/compute/terraform.yaml b/products/compute/terraform.yaml index 6464b089f81a..4e117f9862ba 100644 --- a/products/compute/terraform.yaml +++ b/products/compute/terraform.yaml @@ -1058,6 +1058,17 @@ overrides: !ruby/object:Overrides::ResourceOverrides vars: route_name: "network-route" network_name: "compute-network" + - !ruby/object:Provider::Terraform::Examples + name: "route_ilb_beta" + min_version: "beta" + primary_resource_id: "route-ilb-beta" + vars: + network_name: "compute-network" + subnet_name: "compute-subnet" + forwarding_rule_name: "compute-forwarding-rule" + health_check_name: "proxy-health-check" + backend_name: "compute-backend" + route_name: "route-ilb-beta" properties: name: !ruby/object:Overrides::Terraform::PropertyOverride validation: !ruby/object:Provider::Terraform::Validation @@ -1066,6 +1077,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides diff_suppress_func: 'compareSelfLinkOrResourceName' priority: !ruby/object:Overrides::Terraform::PropertyOverride default_value: 1000 + nextHopIp: !ruby/object:Overrides::Terraform::PropertyOverride + default_from_api: true nextHopGateway: !ruby/object:Overrides::Terraform::PropertyOverride diff_suppress_func: 'compareSelfLinkOrResourceName' custom_expand: templates/terraform/custom_expand/route_gateway.erb diff --git a/templates/terraform/examples/route_ilb_beta.tf.erb b/templates/terraform/examples/route_ilb_beta.tf.erb new file mode 100644 index 000000000000..ffd8fb5dfb25 --- /dev/null +++ b/templates/terraform/examples/route_ilb_beta.tf.erb @@ -0,0 +1,52 @@ +resource "google_compute_network" "default" { + provider = "google-beta" + name = "<%= ctx[:vars]['network_name'] %>" + auto_create_subnetworks = false +} + +resource "google_compute_subnetwork" "default" { + provider = "google-beta" + name = "<%= ctx[:vars]['subnet_name'] %>" + ip_cidr_range = "10.0.1.0/24" + region = "us-central1" + network = "${google_compute_network.default.self_link}" +} + +resource "google_compute_health_check" "hc" { + provider = "google-beta" + name = "<%= ctx[:vars]['health_check_name'] %>" + check_interval_sec = 1 + timeout_sec = 1 + + tcp_health_check { + port = "80" + } +} + +resource "google_compute_region_backend_service" "backend" { + provider = "google-beta" + name = "<%= ctx[:vars]['backend_name'] %>" + region = "us-central1" + health_checks = ["${google_compute_health_check.hc.self_link}"] +} + +resource "google_compute_forwarding_rule" "default" { + provider = "google-beta" + name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + region = "us-central1" + + load_balancing_scheme = "INTERNAL" + backend_service = "${google_compute_region_backend_service.backend.self_link}" + all_ports = true + network = "${google_compute_network.default.name}" + subnetwork = "${google_compute_subnetwork.default.name}" +} + +resource "google_compute_route" "<%= ctx[:primary_resource_id] %>" { + provider = "google-beta" + name = "<%= ctx[:vars]['route_name'] %>" + dest_range = "0.0.0.0/0" + network = "${google_compute_network.default.name}" + next_hop_ilb = "${google_compute_forwarding_rule.default.self_link}" + priority = 2000 +}