github.com/terraform-modules-krish/terratest@v0.29.0/examples/terraform-aws-network-example/README.md (about) 1 # Terraform AWS Network Example 2 3 This folder contains a Terraform module that deploys a simple network setup to demonstrate how you can use Terratest to write automated tests for your AWS Terraform code. This module deploys two subnets within one availability zone. One subnet is public - it has a route to an internet gateway. The other subnet is private. There is a NAT gateway deployed and configured for it. 4 Check out [test/terraform_aws_network_example_test.go](https://github.com/terraform-modules-krish/terratest/blob/v0.29.0/test/terraform_aws_network_example_test.go) to see how you can write automated tests for this module and verify the basic parameters of the VPC and subnets. 5 6 **WARNING**: This module and the automated tests for it deploy real resources into your AWS account which can cost you 7 money. The resources are all part of the [AWS Free Tier](https://aws.amazon.com/rds/free/), so if you haven't used that up, 8 it should be free, but you are completely responsible for all AWS charges. 9 10 11 12 ## Running this module manually 13 14 1. Sign up for [AWS](https://aws.amazon.com/). 15 1. Configure your AWS credentials using one of the [supported methods for AWS CLI 16 tools](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html), such as setting the 17 `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables. If you're using the `~/.aws/config` file for profiles then export `AWS_SDK_LOAD_CONFIG` as "True". 18 1. Set the AWS region you want to use as the environment variable `AWS_DEFAULT_REGION`. 19 1. Install [Terraform](https://www.terraform.io/) and make sure it's on your `PATH`. 20 1. Run `terraform init`. 21 1. Run `terraform apply`. 22 1. When you're done, run `terraform destroy`. 23 24 25 26 27 ## Running automated tests against this module 28 29 1. Sign up for [AWS](https://aws.amazon.com/). 30 1. Configure your AWS credentials using one of the [supported methods for AWS CLI 31 tools](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html), such as setting the 32 `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables. If you're using the `~/.aws/config` file for profiles then export `AWS_SDK_LOAD_CONFIG` as "True". 33 1. Install [Terraform](https://www.terraform.io/) and make sure it's on your `PATH`. 34 1. Install [Golang](https://golang.org/) and make sure this code is checked out into your `GOPATH`. 35 1. `cd test` 36 1. `dep ensure` 37 1. `go test -v -run TestTerraformAwsNetworkExample`