2016-12-01 17:24:51 +00:00
|
|
|
---
|
2019-05-01 22:20:15 +00:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
|
|
#
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# This file is automatically generated by Magic Modules and manual
|
|
|
|
# changes will be clobbered when the file is regenerated.
|
|
|
|
#
|
|
|
|
# Please read more about how to change this file in
|
|
|
|
# .github/CONTRIBUTING.md.
|
|
|
|
#
|
|
|
|
# ----------------------------------------------------------------------------
|
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: |-
|
2019-05-01 22:20:15 +00:00
|
|
|
A Region Backend Service defines a regionally-scoped group of virtual
|
|
|
|
machines that will serve traffic for load balancing.
|
2016-12-01 17:24:51 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# google\_compute\_region\_backend\_service
|
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
A Region Backend Service defines a regionally-scoped group of virtual
|
|
|
|
machines that will serve traffic for load balancing.
|
2016-12-08 19:04:01 +00:00
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
Region backend services can only be used when using internal load balancing.
|
|
|
|
For external load balancing, use a global backend service instead.
|
2018-07-06 11:17:37 +00:00
|
|
|
|
2016-12-01 17:24:51 +00:00
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
To get more information about RegionBackendService, see:
|
2016-12-01 17:24:51 +00:00
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
* [API documentation](https://cloud.google.com/compute/docs/reference/latest/regionBackendServices)
|
|
|
|
* How-to Guides
|
|
|
|
* [Internal TCP/UDP Load Balancing](https://cloud.google.com/compute/docs/load-balancing/internal/)
|
2016-12-01 17:24:51 +00:00
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
|
|
|
|
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=region_backend_service_basic&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
|
|
|
|
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
## Example Usage - Region Backend Service Basic
|
2016-12-01 17:24:51 +00:00
|
|
|
|
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
```hcl
|
|
|
|
resource "google_compute_region_backend_service" "default" {
|
|
|
|
name = "region-backend-service"
|
|
|
|
region = "us-central1"
|
|
|
|
health_checks = ["${google_compute_health_check.default.self_link}"]
|
|
|
|
connection_draining_timeout_sec = 10
|
|
|
|
session_affinity = "CLIENT_IP"
|
2016-12-01 17:24:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_health_check" "default" {
|
2019-05-01 22:20:15 +00:00
|
|
|
name = "health-check"
|
2016-12-01 17:24:51 +00:00
|
|
|
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:
|
|
|
|
|
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
* `name` -
|
|
|
|
(Required)
|
|
|
|
Name of the resource. Provided by the client when the resource is
|
|
|
|
created. The name must be 1-63 characters long, and comply with
|
|
|
|
RFC1035. Specifically, the name must be 1-63 characters long and match
|
|
|
|
the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the
|
|
|
|
first character must be a lowercase letter, and all following
|
|
|
|
characters must be a dash, lowercase letter, or digit, except the last
|
|
|
|
character, which cannot be a dash.
|
|
|
|
|
|
|
|
* `health_checks` -
|
|
|
|
(Required)
|
|
|
|
The list of HealthChecks 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
|
|
|
|
|
|
|
- - -
|
|
|
|
|
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
* `backend` -
|
|
|
|
(Optional)
|
|
|
|
The list of backends that serve this RegionBackendService. Structure is documented below.
|
2016-12-01 17:24:51 +00:00
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
* `description` -
|
|
|
|
(Optional)
|
|
|
|
An optional description of this resource.
|
2016-12-01 17:24:51 +00:00
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
* `protocol` -
|
|
|
|
(Optional)
|
|
|
|
The protocol this BackendService uses to communicate with backends.
|
|
|
|
The possible values are TCP and UDP, and the default is TCP.
|
2016-12-01 17:24:51 +00:00
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
* `session_affinity` -
|
|
|
|
(Optional)
|
|
|
|
Type of session affinity to use. The default is NONE.
|
|
|
|
Can be NONE, CLIENT_IP, CLIENT_IP_PROTO, or CLIENT_IP_PORT_PROTO.
|
|
|
|
When the protocol is UDP, this field is not used.
|
2017-01-18 00:32:58 +00:00
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
* `region` -
|
|
|
|
(Optional)
|
|
|
|
The Region in which the created backend service should reside.
|
|
|
|
If it is not provided, the provider region is used.
|
2016-12-01 17:24:51 +00:00
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
* `timeout_sec` -
|
|
|
|
(Optional)
|
|
|
|
How many seconds to wait for the backend before considering it a
|
|
|
|
failed request. Default is 30 seconds. Valid range is [1, 86400].
|
2016-12-01 17:24:51 +00:00
|
|
|
|
2019-05-01 22:20: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).
|
2016-12-01 17:24:51 +00:00
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
* `load_balancing_scheme` -
|
|
|
|
(Optional)
|
|
|
|
This signifies what the ForwardingRule will be used for and can only
|
|
|
|
be INTERNAL for RegionBackendServices
|
|
|
|
* `project` - (Optional) The ID of the project in which the resource belongs.
|
|
|
|
If it is not provided, the provider project is used.
|
2016-12-01 17:24:51 +00:00
|
|
|
|
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
The `backend` block supports:
|
|
|
|
|
|
|
|
* `description` -
|
|
|
|
(Optional)
|
|
|
|
An optional description of this resource.
|
|
|
|
Provide this property when you create the resource.
|
|
|
|
|
|
|
|
* `group` -
|
|
|
|
(Optional)
|
|
|
|
The fully-qualified URL of an Instance Group. This defines the list
|
|
|
|
of instances that serve traffic. Member virtual machine
|
|
|
|
instances from each instance group must live in the same zone as
|
|
|
|
the instance group itself. No two backends in a backend service
|
|
|
|
are allowed to use same Instance Group resource.
|
|
|
|
Note that you must specify an Instance Group
|
|
|
|
resource using the fully-qualified URL, rather than a
|
|
|
|
partial URL.
|
|
|
|
The instance group must be within the same region as the BackendService.
|
2016-12-01 17:24:51 +00:00
|
|
|
|
|
|
|
## Attributes Reference
|
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
In addition to the arguments listed above, the following computed attributes are exported:
|
2016-12-01 17:24:51 +00:00
|
|
|
|
|
|
|
|
2019-05-01 22:20:15 +00:00
|
|
|
* `fingerprint` -
|
|
|
|
Fingerprint of this resource. A hash of the contents stored in this
|
|
|
|
object. This field is used in optimistic locking.
|
2016-12-01 17:24:51 +00:00
|
|
|
* `self_link` - The URI of the created resource.
|
2019-05-01 22:20:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
## Timeouts
|
|
|
|
|
|
|
|
This resource provides the following
|
|
|
|
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:
|
|
|
|
|
|
|
|
- `create` - Default is 4 minutes.
|
|
|
|
- `update` - Default is 4 minutes.
|
|
|
|
- `delete` - Default is 4 minutes.
|
|
|
|
|
|
|
|
## Import
|
|
|
|
|
|
|
|
RegionBackendService can be imported using any of these accepted formats:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ terraform import google_compute_region_backend_service.default projects/{{project}}/regions/{{region}}/backendServices/{{name}}
|
|
|
|
$ terraform import google_compute_region_backend_service.default {{project}}/{{region}}/{{name}}
|
|
|
|
$ terraform import google_compute_region_backend_service.default {{name}}
|
|
|
|
```
|
|
|
|
|
|
|
|
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
|
|
|
|
as an argument so that Terraform uses the correct provider to import your resource.
|