github.com/terraform-modules-krish/terratest@v0.29.0/examples/terraform-gcp-ig-example/README.md (about) 1 # Terraform GCP Managed Instance Group Example 2 3 This folder contains a simple Terraform configuration that deploys resources in [GCP](https://cloud.google.com/) to demonstrate 4 how you can use Terratest to write automated tests for your GCP Terraform code. This module deploys an [Instance Group]( 5 https://cloud.google.com/compute/docs/instance-groups/). 6 7 Check out [test/terraform_gcp_ig_example_test.go](https://github.com/terraform-modules-krish/terratest/blob/v0.29.0/test/terraform_gcp_ig_example_test.go) to see how you can write 8 automated tests for this module. 9 10 Note that the Instance Group in this module doesn't actually do anything; it just runs a cluster of vanilla Ubuntu 16.04 11 Images for demonstration purposes. For slightly more complicated, real-world examples of Terraform modules, see 12 [terraform-http-example](https://github.com/terraform-modules-krish/terratest/blob/v0.29.0/examples/terraform-http-example) and [terraform-ssh-example](https://github.com/terraform-modules-krish/terratest/blob/v0.29.0/examples/terraform-ssh-example). 13 14 **WARNING**: This module and the automated tests for it deploy real resources into your GCP account which can cost you 15 money. By launching multiple Instances as part of an Instance Group, these resources may go beyond the [GCP Free Tier]( 16 https://cloud.google.com/free/). Naturally, you are completely responsible for all GCP charges. 17 18 ## Running this module manually 19 20 1. Sign up for [GCP](https://cloud.google.com/). 21 1. Configure your GCP credentials using one of the [supported methods for GCP CLI 22 tools](https://cloud.google.com/sdk/docs/quickstarts). 23 1. Install [Terraform](https://www.terraform.io/) and make sure it's in your `PATH`. 24 1. Ensure the desired Project ID is set: `export GOOGLE_CLOUD_PROJECT=terratest-ABCXYZ`. 25 1. Run `terraform init`. 26 1. Run `terraform apply`. 27 1. When you're done, run `terraform destroy`. 28 29 ## Running automated tests against this module 30 31 1. Sign up for [GCP](https://cloud.google.com/free/). 32 1. Configure your GCP credentials using the [GCP CLI 33 tools](https://cloud.google.com/sdk/docs/quickstarts). 34 1. Install [Terraform](https://www.terraform.io/) and make sure it's on your `PATH`. 35 1. Install [Golang](https://golang.org/) and make sure this code is checked out into your `GOPATH`. 36 1. Set `GOOGLE_CLOUD_PROJECT` environment variable to your project name. 37 1. `cd test` 38 1. `dep ensure` 39 1. `go test -v -run TestTerraformGcpInstanceGroupExample`