Merge pull request #10453 from danawillow/google-ilb

providers/google: Add support for Internal Load Balancing
This commit is contained in:
Paddy 2016-12-12 09:47:20 -08:00 committed by GitHub
commit e4d84578ad
3 changed files with 275 additions and 5 deletions

View File

@ -15,7 +15,7 @@ documentation](https://cloud.google.com/compute/docs/load-balancing/network/forw
## Example Usage
```js
```tf
resource "google_compute_forwarding_rule" "default" {
name = "test"
target = "${google_compute_target_pool.default.self_link}"
@ -30,20 +30,32 @@ The following arguments are supported:
* `name` - (Required) A unique name for the resource, required by GCE. Changing
this forces a new resource to be created.
* `target` - (Required) URL of target pool.
- - -
* `backend_service` - (Optional) BackendService resource to receive the
matched traffic. Only used for internal load balancing.
* `description` - (Optional) Textual description field.
* `ip_address` - (Optional) The static IP. (if not set, an ephemeral IP is
used).
* `ip_protocol` - (Optional) The IP protocol to route, one of "TCP" "UDP" "AH"
"ESP" or "SCTP". (default "TCP").
"ESP" or "SCTP" for external load balancing, "TCP" or "UDP" for internal
(default "TCP").
* `load_balancing_scheme` - (Optional) Type of load balancing to use. Can be
set to "INTERNAL" or "EXTERNAL" (default "EXTERNAL").
* `network` - (Optional) Network that the load balanced IP should belong to.
Only used for internal load balancing. If it is not provided, the default
network is used.
* `port_range` - (Optional) A range e.g. "1024-2048" or a single port "1024"
(defaults to all ports!).
(defaults to all ports!). Only used for external load balancing.
* `ports` - (Optional) A list of ports to use for internal load balancing
(defaults to all ports).
* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.
@ -51,6 +63,13 @@ The following arguments are supported:
* `region` - (Optional) The Region in which the created address should reside.
If it is not provided, the provider region is used.
* `subnetwork` - (Optional) Subnetwork that the load balanced IP should belong
to. Only used for internal load balancing. Must be specified if the network
is in custom subnet mode.
* `target` - (Optional) URL of target pool. Required for external load
balancing.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are

View File

@ -0,0 +1,124 @@
---
layout: "google"
page_title: "Google: google_compute_health_check"
sidebar_current: "docs-google-compute-health-check"
description: |-
Manages a Health Check within GCE.
---
# google\_compute\_health\_check
Manages a health check within GCE. This is used to monitor instances
behind load balancers. Timeouts or HTTP errors cause the instance to be
removed from the pool. For more information, see [the official
documentation](https://cloud.google.com/compute/docs/load-balancing/health-checks)
and
[API](https://cloud.google.com/compute/docs/reference/latest/healthChecks).
## Example Usage
```tf
resource "google_compute_health_check" "default" {
name = "test"
timeout_sec = 1
check_interval_sec = 1
tcp_health_check {
port = "80"
}
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) A unique name for the resource, required by GCE.
Changing this forces a new resource to be created.
- - -
* `check_interval_sec` - (Optional) The number of seconds between each poll of
the instance instance (default 5).
* `description` - (Optional) Textual description field.
* `healthy_threshold` - (Optional) Consecutive successes required (default 2).
* `http_health_check` - (Optional) An HTTP Health Check.
See *HTTP Health Check* below.
* `https_health_check` - (Optional) An HTTPS Health Check.
See *HTTPS Health Check* below.
* `ssl_health_check` - (Optional) An SSL Health Check.
See *SSL Health Check* below.
* `tcp_health_check` - (Optional) A TCP Health Check.
See *TCP Health Check* below.
* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.
* `timeout_sec` - (Optional) The number of seconds to wait before declaring
failure (default 5).
* `unhealthy_threshold` - (Optional) Consecutive failures required (default 2).
**HTTP Health Check** supports the following attributes:
* `host` - (Optional) HTTP host header field (default instance's public ip).
* `port` - (Optional) TCP port to connect to (default 80).
* `proxy_header` - (Optional) Type of proxy header to append before sending
data to the backend, either NONE or PROXY_V1 (default NONE).
* `request_path` - (Optional) URL path to query (default /).
**HTTPS Health Check** supports the following attributes:
* `host` - (Optional) HTTPS host header field (default instance's public ip).
* `port` - (Optional) TCP port to connect to (default 443).
* `proxy_header` - (Optional) Type of proxy header to append before sending
data to the backend, either NONE or PROXY_V1 (default NONE).
* `request_path` - (Optional) URL path to query (default /).
**SSL Health Check** supports the following attributes:
* `port` - (Optional) TCP port to connect to (default 443).
* `proxy_header` - (Optional) Type of proxy header to append before sending
data to the backend, either NONE or PROXY_V1 (default NONE).
* `request` - (Optional) Application data to send once the SSL connection has
been established (default "").
* `response` - (Optional) The response that indicates health (default "")
**TCP Health Check** supports the following attributes:
* `port` - (Optional) TCP port to connect to (default 80).
* `proxy_header` - (Optional) Type of proxy header to append before sending
data to the backend, either NONE or PROXY_V1 (default NONE).
* `request` - (Optional) Application data to send once the TCP connection has
been established (default "").
* `response` - (Optional) The response that indicates health (default "")
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are
exported:
* `self_link` - The URI of the created resource.

View File

@ -0,0 +1,127 @@
---
layout: "google"
page_title: "Google: google_compute_region_backend_service"
sidebar_current: "docs-google-compute-region-backend-service"
description: |-
Creates a Region Backend Service resource for Google Compute Engine.
---
# google\_compute\_region\_backend\_service
A Region Backend Service defines a regionally-scoped group of virtual machines that will serve traffic for load balancing.
See [backendServices](https://cloud.google.com/compute/docs/reference/latest/backendServices) documentation for more on this resource type, and [Internal Load Balancing](https://cloud.google.com/compute/docs/load-balancing/internal/) documentation for more details on usage.
## Example Usage
```tf
resource "google_compute_region_backend_service" "foobar" {
name = "blablah"
description = "Hello World 1234"
protocol = "TCP"
timeout_sec = 10
backend {
group = "${google_compute_instance_group_manager.foo.instance_group}"
}
health_checks = ["${google_compute_health_check.default.self_link}"]
}
resource "google_compute_instance_group_manager" "foo" {
name = "terraform-test"
instance_template = "${google_compute_instance_template.foobar.self_link}"
base_instance_name = "foobar"
zone = "us-central1-f"
target_size = 1
}
resource "google_compute_instance_template" "foobar" {
name = "terraform-test"
machine_type = "n1-standard-1"
network_interface {
network = "default"
}
disk {
source_image = "debian-cloud/debian-8"
auto_delete = true
boot = true
}
}
resource "google_compute_health_check" "default" {
name = "test"
check_interval_sec = 1
timeout_sec = 1
type = "TCP"
tcp_health_check {
port = "80"
}
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The name of the backend service.
* `health_checks` - (Required) Specifies a list of health check objects
for checking the health of the backend service.
- - -
* `backend` - (Optional) The list of backends that serve this BackendService.
See *Backend* below.
* `description` - (Optional) The textual description for the backend service.
* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.
* `protocol` - (Optional) The protocol for incoming requests. Defaults to
`HTTP`.
* `region` - (Optional) The Region in which the created address should reside.
If it is not provided, the provider region is used.
* `timeout_sec` - (Optional) The number of secs to wait for a backend to respond
to a request before considering the request failed. Defaults to `30`.
**Backend** supports the following attributes:
* `group` - (Required) The name or URI of a Compute Engine instance group
(`google_compute_instance_group_manager.xyz.instance_group`) that can
receive traffic.
* `balancing_mode` - (Optional) Defines the strategy for balancing load.
Defaults to `UTILIZATION`
* `capacity_scaler` - (Optional) A float in the range [0, 1.0] that scales the
maximum parameters for the group (e.g., max rate). A value of 0.0 will cause
no requests to be sent to the group (i.e., it adds the group in a drained
state). The default is 1.0.
* `description` - (Optional) Textual description for the backend.
* `max_rate` - (Optional) Maximum requests per second (RPS) that the group can
handle.
* `max_rate_per_instance` - (Optional) The maximum per-instance requests per
second (RPS).
* `max_utilization` - (Optional) The target CPU utilization for the group as a
float in the range [0.0, 1.0]. This flag can only be provided when the
balancing mode is `UTILIZATION`. Defaults to `0.8`.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are
exported:
* `fingerprint` - The fingerprint of the backend service.
* `self_link` - The URI of the created resource.