github.com/alkar/terraform@v0.9.6-0.20170517124458-a4cddf6ebf59/examples/google-content-based-load-balancing/README.md (about) 1 # Content Based Load Balancing in Google Cloud 2 3 This provides a template for running an HTTP load balancer that distributes traffic to different instances based on the 4 path in the request URL. It is based on the tutorial at [https://cloud.google.com/compute/docs/load-balancing/http/content-based-example](https://cloud.google.com/compute/docs/load-balancing/http/content-based-example). 5 6 To start, [download your credentials from Google Cloud Console](https://www.terraform.io/docs/providers/google/#credentials); suggested path for downloaded file is `~/.gcloud/Terraform.json`. 7 8 Optionally update `variables.tf` to specify a default value for the `project_name` variable, and check other variables. 9 10 After you run `terraform apply` on this configuration, it will 11 automatically output the public IP address of the load balancer. 12 After your instance registers, the LB should respond with the following at its root: 13 14 ```html 15 <h1>www</h1> 16 ``` 17 18 And the following at the /video/ url: 19 ```html 20 <h1>www-video</h1> 21 ``` 22 23 To run, configure your Google Cloud provider as described in 24 25 https://www.terraform.io/docs/providers/google/index.html 26 27 Run with a command like this: 28 29 ``` 30 terraform apply \ 31 -var="region=us-central1" \ 32 -var="region_zone=us-central1-f" \ 33 -var="project_name=my-project-id-123" \ 34 -var="credentials_file_path=~/.gcloud/Terraform.json" \ 35 ```