2016-12-01 17:24:51 +00:00
|
|
|
---
|
|
|
|
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.
|
2017-06-06 12:26:26 +00:00
|
|
|
For more information see [the official documentation](https://cloud.google.com/compute/docs/load-balancing/internal/)
|
|
|
|
and [API](https://cloud.google.com/compute/docs/reference/latest/backendServices).
|
2016-12-08 19:04:01 +00:00
|
|
|
|
2016-12-01 17:24:51 +00:00
|
|
|
## Example Usage
|
|
|
|
|
2017-06-13 21:08:15 +00:00
|
|
|
```hcl
|
2016-12-01 17:24:51 +00:00
|
|
|
resource "google_compute_region_backend_service" "foobar" {
|
2017-02-18 22:48:50 +00:00
|
|
|
name = "blablah"
|
|
|
|
description = "Hello World 1234"
|
|
|
|
protocol = "TCP"
|
|
|
|
timeout_sec = 10
|
|
|
|
session_affinity = "CLIENT_IP"
|
2016-12-01 17:24:51 +00:00
|
|
|
|
|
|
|
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
|
2017-02-18 22:48:50 +00:00
|
|
|
|
2016-12-01 17:24:51 +00:00
|
|
|
tcp_health_check {
|
|
|
|
port = "80"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `name` - (Required) The name of the backend service.
|
|
|
|
|
2017-06-20 17:59:56 +00:00
|
|
|
* `health_checks` - (Required) Specifies a list of health checks
|
2017-06-20 17:26:09 +00:00
|
|
|
for checking the health of the backend service. Currently at most
|
|
|
|
one health check can be specified, and a health check is required.
|
2016-12-01 17:24:51 +00:00
|
|
|
|
|
|
|
- - -
|
|
|
|
|
|
|
|
* `backend` - (Optional) The list of backends that serve this BackendService.
|
2017-06-06 12:26:26 +00:00
|
|
|
Structure is documented below.
|
2016-12-01 17:24:51 +00:00
|
|
|
|
|
|
|
* `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`.
|
|
|
|
|
2017-01-18 00:32:58 +00:00
|
|
|
* `session_affinity` - (Optional) How to distribute load. Options are `NONE` (no
|
|
|
|
affinity), `CLIENT_IP`, `CLIENT_IP_PROTO`, or `CLIENT_IP_PORT_PROTO`.
|
|
|
|
Defaults to `NONE`.
|
|
|
|
|
2016-12-01 17:24:51 +00:00
|
|
|
* `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`.
|
|
|
|
|
2017-06-13 21:08:15 +00:00
|
|
|
* `connection_draining_timeout_sec` - (Optional) Time for which instance will be drained
|
|
|
|
(not accept new connections, but still work to finish started ones). Defaults to `0`.
|
2016-12-01 17:24:51 +00:00
|
|
|
|
2017-06-06 12:26:26 +00:00
|
|
|
The `backend` block supports:
|
2016-12-01 17:24:51 +00:00
|
|
|
|
|
|
|
* `group` - (Required) The name or URI of a Compute Engine instance group
|
|
|
|
(`google_compute_instance_group_manager.xyz.instance_group`) that can
|
2017-06-06 12:26:26 +00:00
|
|
|
receive traffic. Instance groups must contain at least one instance.
|
2016-12-01 17:24:51 +00:00
|
|
|
|
|
|
|
* `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.
|