diff --git a/examples/google-two-tier/README.md b/examples/google-two-tier/README.md index d29cf608e..61bcfbf73 100644 --- a/examples/google-two-tier/README.md +++ b/examples/google-two-tier/README.md @@ -11,6 +11,17 @@ getting your application onto the servers. However, you could do so either via management tool, or by pre-baking configured images with [Packer](https://packer.io/docs/builders/googlecompute.html). +You will need to generate SSH keys as follows: + +```sh +$ ssh-keygen -f ~/.ssh/gcloud_id_rsa +# press when asked (twice) for a pass-phrase +``` + +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`. + +Optionally update `variables.tf` to specify a default value for the `project_name` variable, and check other variables. + After you run `terraform apply` on this configuration, it will automatically output the public IP address of the load balancer. After your instance registers, the LB should respond with a simple header: @@ -33,7 +44,7 @@ terraform apply \ -var="region=us-central1" \ -var="region_zone=us-central1-f" \ -var="project_name=my-project-id-123" \ - -var="account_file_path=~/.gcloud/Terraform.json" \ + -var="credentials_file_path=~/.gcloud/Terraform.json" \ -var="public_key_path=~/.ssh/gcloud_id_rsa.pub" \ -var="private_key_path=~/.ssh/gcloud_id_rsa" ``` diff --git a/examples/google-two-tier/main.tf b/examples/google-two-tier/main.tf index 9c1f82024..c0703a7fe 100644 --- a/examples/google-two-tier/main.tf +++ b/examples/google-two-tier/main.tf @@ -3,7 +3,7 @@ provider "google" { region = "${var.region}" project = "${var.project_name}" - account_file = "${file(var.account_file_path)}" + credentials = "${file("${var.credentials_file_path}")}" } resource "google_compute_http_health_check" "default" { @@ -31,31 +31,47 @@ resource "google_compute_instance" "www" { count = 3 name = "tf-www-${count.index}" - machine_type = "n1-standard-1" + machine_type = "f1-micro" zone = "${var.region_zone}" tags = ["www-node"] disk { - image = "ubuntu-os-cloud/ubuntu-1204-precise-v20150625" + image = "ubuntu-os-cloud/ubuntu-1404-trusty-v20160314" } network_interface { network = "default" access_config { - # Ephemeral + # Ephemeral } } metadata { - sshKeys = "ubuntu:${file("~/.ssh/gcloud_id_rsa.pub")}" - startup-script = <