Skip to content

Commit

Permalink
Adding next_hop_ilb attribute to compute route resource (#2215)
Browse files Browse the repository at this point in the history
Merged PR #2215.
  • Loading branch information
Madankapoor authored and modular-magician committed Aug 26, 2019
1 parent 32756c9 commit d481725
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
12 changes: 12 additions & 0 deletions products/compute/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
13 changes: 13 additions & 0 deletions products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
52 changes: 52 additions & 0 deletions templates/terraform/examples/route_ilb_beta.tf.erb
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit d481725

Please sign in to comment.