github.com/koding/terraform@v0.6.4-0.20170608090606-5d7e0339779d/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-compute-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. For more information 12 see [the official documentation](https://cloud.google.com/compute/docs/load-balancing/http/backend-service) 13 and the [API](https://cloud.google.com/compute/docs/reference/latest/backendServices). 14 15 For internal load balancing, use a [google_compute_region_backend_service](/docs/providers/google/r/compute_region_backend_service.html). 16 17 ## Example Usage 18 19 ```hcl 20 resource "google_compute_backend_service" "foobar" { 21 name = "blablah" 22 description = "Hello World 1234" 23 port_name = "http" 24 protocol = "HTTP" 25 timeout_sec = 10 26 enable_cdn = false 27 28 backend { 29 group = "${google_compute_instance_group_manager.foo.instance_group}" 30 } 31 32 health_checks = ["${google_compute_http_health_check.default.self_link}"] 33 } 34 35 resource "google_compute_instance_group_manager" "foo" { 36 name = "terraform-test" 37 instance_template = "${google_compute_instance_template.foobar.self_link}" 38 base_instance_name = "foobar" 39 zone = "us-central1-f" 40 target_size = 1 41 } 42 43 resource "google_compute_instance_template" "foobar" { 44 name = "terraform-test" 45 machine_type = "n1-standard-1" 46 47 network_interface { 48 network = "default" 49 } 50 51 disk { 52 source_image = "debian-cloud/debian-8" 53 auto_delete = true 54 boot = true 55 } 56 } 57 58 resource "google_compute_http_health_check" "default" { 59 name = "test" 60 request_path = "/" 61 check_interval_sec = 1 62 timeout_sec = 1 63 } 64 ``` 65 66 ## Argument Reference 67 68 The following arguments are supported: 69 70 * `name` - (Required) The name of the backend service. 71 72 * `health_checks` - (Required) Specifies a list of HTTP health check objects 73 for checking the health of the backend service. 74 75 - - - 76 77 * `backend` - (Optional) The list of backends that serve this BackendService. Structure is documented below. 78 79 * `description` - (Optional) The textual description for the backend service. 80 81 * `enable_cdn` - (Optional) Whether or not to enable the Cloud CDN on the backend service. 82 83 * `port_name` - (Optional) The name of a service that has been added to an 84 instance group in this backend. See [related docs](https://cloud.google.com/compute/docs/instance-groups/#specifying_service_endpoints) for details. Defaults to http. 85 86 * `project` - (Optional) The project in which the resource belongs. If it 87 is not provided, the provider project is used. 88 89 * `protocol` - (Optional) The protocol for incoming requests. Defaults to 90 `HTTP`. 91 92 * `session_affinity` - (Optional) How to distribute load. Options are `NONE` (no 93 affinity), `CLIENT_IP` (hash of the source/dest addresses / ports), and 94 `GENERATED_COOKIE` (distribute load using a generated session cookie). 95 96 * `timeout_sec` - (Optional) The number of secs to wait for a backend to respond 97 to a request before considering the request failed. Defaults to `30`. 98 99 * `connection_draining_timeout_sec` - (Optional) Time for which instance will be drained (not accept new connections, 100 but still work to finish started ones). Defaults to `0`. 101 102 The `backend` block supports: 103 104 * `group` - (Required) The name or URI of a Compute Engine instance group 105 (`google_compute_instance_group_manager.xyz.instance_group`) that can 106 receive traffic. 107 108 * `balancing_mode` - (Optional) Defines the strategy for balancing load. 109 Defaults to `UTILIZATION` 110 111 * `capacity_scaler` - (Optional) A float in the range [0, 1.0] that scales the 112 maximum parameters for the group (e.g., max rate). A value of 0.0 will cause 113 no requests to be sent to the group (i.e., it adds the group in a drained 114 state). The default is 1.0. 115 116 * `description` - (Optional) Textual description for the backend. 117 118 * `max_rate` - (Optional) Maximum requests per second (RPS) that the group can 119 handle. 120 121 * `max_rate_per_instance` - (Optional) The maximum per-instance requests per 122 second (RPS). 123 124 * `max_utilization` - (Optional) The target CPU utilization for the group as a 125 float in the range [0.0, 1.0]. This flag can only be provided when the 126 balancing mode is `UTILIZATION`. Defaults to `0.8`. 127 128 ## Attributes Reference 129 130 In addition to the arguments listed above, the following computed attributes are 131 exported: 132 133 * `fingerprint` - The fingerprint of the backend service. 134 135 * `self_link` - The URI of the created resource.