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