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