github.com/ewbankkit/terraform@v0.7.7/examples/google-two-tier/README.md (about)

     1  # Basic Two-Tier Architecture in Google Cloud
     2  
     3  This provides a template for running a simple two-tier architecture on Google Cloud.
     4  The premise is that you have stateless app servers running behind
     5  a load balancer serving traffic.
     6  
     7  To simplify the example, this intentionally ignores deploying and
     8  getting your application onto the servers. However, you could do so either via
     9  [startup script](http://terraform.io/docs/providers/google/r/compute_instance.html#metadata_startup_script) or
    10  [provisioners](https://www.terraform.io/docs/provisioners/) and a configuration
    11  management tool, or by pre-baking configured images with
    12  [Packer](https://packer.io/docs/builders/googlecompute.html).
    13  
    14  You will need to generate SSH keys as follows:
    15  
    16  ```sh
    17  $ ssh-keygen -f ~/.ssh/gcloud_id_rsa
    18  # press <Enter> when asked (twice) for a pass-phrase
    19  ```
    20  
    21  Then [download your credentials from Google Cloud Console](https://www.terraform.io/docs/providers/google/#credentials); suggested path for downloaded file is `~/.gcloud/Terraform.json`.
    22  
    23  Optionally update `variables.tf` to specify a default value for the `project_name` variable, and check other variables.
    24  
    25  After you run `terraform apply` on this configuration, it will
    26  automatically output the public IP address of the load balancer.
    27  After your instance registers, the LB should respond with a simple header:
    28  
    29  ```html
    30  <h1>Welcome to instance 0</h1>
    31  ```
    32  
    33  The index may differ once you increase `count` of `google_compute_instance`
    34  (i.e. provision more instances).
    35  
    36  To run, configure your Google Cloud provider as described in
    37  
    38  https://www.terraform.io/docs/providers/google/index.html
    39  
    40  Run with a command like this:
    41  
    42  ```
    43  terraform apply \
    44  	-var="region=us-central1" \
    45  	-var="region_zone=us-central1-f" \
    46  	-var="project_name=my-project-id-123" \
    47  	-var="credentials_file_path=~/.gcloud/Terraform.json" \
    48  	-var="public_key_path=~/.ssh/gcloud_id_rsa.pub" \
    49  	-var="private_key_path=~/.ssh/gcloud_id_rsa"
    50  ```