github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/examples/terraform-aws-ecs-example/README.md (about) 1 # Terraform AWS ECS Example 2 3 This folder contains a simple Terraform module that deploys a simple ECS service in [AWS](https://aws.amazon.com/) 4 to demonstrate how you can use Terratest to write automated tests for your AWS Terraform code. 5 6 This module registers a task definition with [AWS Fargate](https://aws.amazon.com/fargate/) launch type and associates it with a [service](https://docs.aws.amazon.com/AmazonECS/latest/userguide/ecs_services.html) 7 to run and maintain a specified number of instances. 8 9 Check out [test/terraform_aws_ecs_example_test.go](/test/terraform_aws_ecs_example_test.go) to see how you can write 10 automated tests for this module and validate the configuration of the parameters and options. 11 12 **WARNING**: This module and the automated tests for it deploy real resources into your AWS account which can cost you 13 money. 14 15 ## Running this module manually 16 17 1. Sign up for [AWS](https://aws.amazon.com/). 18 1. Configure your AWS credentials using one of the [supported methods for AWS CLI 19 tools](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html), such as setting the 20 `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". 21 1. Set the AWS region you want to use as the environment variable `AWS_DEFAULT_REGION`. 22 1. Install [Terraform](https://www.terraform.io/) and make sure it's on your `PATH`. 23 1. Run `terraform init`. 24 1. Run `terraform apply`. 25 1. When you're done, run `terraform destroy`. 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 TestTerraformAwsEcsExample`