github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/examples/terraform-backend-example/README.md (about) 1 # Terraform Backend Example 2 3 This folder contains a simple Terraform module that demonstrates how you can use Terratest to configure a [Terraform 4 Backend](https://www.terraform.io/docs/backends/) at test time. This module doesn't really do anything other than set 5 up S3 as a backend, and allow Terratest to fill in that backend's configuration. 6 7 Check out [test/terraform_backend_example_test.go](/test/terraform_backend_example_test.go) to see how you can write 8 automated tests for this module. 9 10 **WARNING**: This module and the automated tests for it deploy real resources into your AWS account which can cost you 11 money. The resources are all part of the [AWS Free Tier](https://aws.amazon.com/free/), so if you haven't used that up, 12 it should be free, but you are completely responsible for all AWS charges. 13 14 15 16 17 18 ## Running this module manually 19 20 1. Sign up for [AWS](https://aws.amazon.com/). 21 1. Configure your AWS credentials using one of the [supported methods for AWS CLI 22 tools](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html), such as setting the 23 `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". 24 1. Set the AWS region you want to use as the environment variable `AWS_DEFAULT_REGION`. 25 1. Install [Terraform](https://www.terraform.io/) and make sure it's on your `PATH`. 26 1. Run `terraform init`. 27 1. Run `terraform apply`. 28 1. When you're done, run `terraform destroy`. 29 30 31 32 33 ## Running automated tests against this module 34 35 1. Sign up for [AWS](https://aws.amazon.com/). 36 1. Configure your AWS credentials using one of the [supported methods for AWS CLI 37 tools](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html), such as setting the 38 `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". 39 1. Install [Terraform](https://www.terraform.io/) and make sure it's on your `PATH`. 40 1. Install [Golang](https://golang.org/) and make sure this code is checked out into your `GOPATH`. 41 1. `cd test` 42 1. `dep ensure` 43 1. `go test -v -run TestTerraformBackendExample`