github.com/atsaki/terraform@v0.4.3-0.20150919165407-25bba5967654/website/source/docs/providers/google/r/compute_backend_service.html.markdown (about) 1 --- 2 layout: "google" 3 page_title: "Google: google_compute_backend_service" 4 sidebar_current: "docs-google-resource-backend-service" 5 description: |- 6 Creates a Backend Service resource for Google Compute Engine. 7 --- 8 9 # google\_compute\_backend\_service 10 11 A Backend Service defines a group of virtual machines that will serve traffic for load balancing. 12 13 ## Example Usage 14 15 ``` 16 resource "google_compute_backend_service" "foobar" { 17 name = "blablah" 18 description = "Hello World 1234" 19 port_name = "http" 20 protocol = "HTTP" 21 timeout_sec = 10 22 23 backend { 24 group = "${google_compute_instance_group_manager.foo.instance_group}" 25 } 26 27 health_checks = ["${google_compute_http_health_check.default.self_link}"] 28 } 29 30 resource "google_compute_instance_group_manager" "foo" { 31 name = "terraform-test" 32 instance_template = "${google_compute_instance_template.foobar.self_link}" 33 base_instance_name = "foobar" 34 zone = "us-central1-f" 35 target_size = 1 36 } 37 38 resource "google_compute_instance_template" "foobar" { 39 name = "terraform-test" 40 machine_type = "n1-standard-1" 41 42 network_interface { 43 network = "default" 44 } 45 46 disk { 47 source_image = "debian-7-wheezy-v20140814" 48 auto_delete = true 49 boot = true 50 } 51 } 52 53 resource "google_compute_http_health_check" "default" { 54 name = "test" 55 request_path = "/" 56 check_interval_sec = 1 57 timeout_sec = 1 58 } 59 ``` 60 61 ## Argument Reference 62 63 The following arguments are supported: 64 65 * `name` - (Required) The name of the backend service. 66 * `health_checks` - (Required) Specifies a list of HTTP health check objects 67 for checking the health of the backend service. 68 * `description` - (Optional) The textual description for the backend service. 69 * `backend` - (Optional) The list of backends that serve this BackendService. See *Backend* below. 70 * `port_name` - (Optional) The name of a service that has been added to 71 an instance group in this backend. See [related docs](https://cloud.google.com/compute/docs/instance-groups/#specifying_service_endpoints) 72 for details. Defaults to http. 73 * `protocol` - (Optional) The protocol for incoming requests. Defaults to `HTTP`. 74 * `timeout_sec` - (Optional) The number of secs to wait for a backend to respond 75 to a request before considering the request failed. Defaults to `30`. 76 77 **Backend** supports the following attributes: 78 79 * `group` - (Required) The name or URI of a Compute Engine instance group (`google_compute_instance_group_manager.xyz.instance_group`) that can receive traffic. 80 * `balancing_mode` - (Optional) Defines the strategy for balancing load. Defaults to `UTILIZATION` 81 * `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. 82 * `description` - (Optional) Textual description for the backend. 83 * `max_rate` - (Optional) Maximum requests per second (RPS) that the group can handle. 84 * `max_rate_per_instance` - (Optional) The maximum per-instance requests per second (RPS). 85 * `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`. 86 87 ## Attributes Reference 88 89 The following attributes are exported: 90 91 * `name` - The name of the resource. 92 * `self_link` - The URI of the created resource.