open-consul/test/load/terraform
s-christoff e9512fbff6
Allow consul version/consul download url to be inputted via Terraform (#9267)
2020-12-11 13:11:14 -06:00
..
.gitignore Add load testing framework (#8571) 2020-10-05 20:16:09 -05:00
README.md Allow consul version/consul download url to be inputted via Terraform (#9267) 2020-12-11 13:11:14 -06:00
consul.tf Allow consul version/consul download url to be inputted via Terraform (#9267) 2020-12-11 13:11:14 -06:00
main.tf Add load testing framework (#8571) 2020-10-05 20:16:09 -05:00
outputs.tf Add load testing framework (#8571) 2020-10-05 20:16:09 -05:00
providers.tf Add load testing framework (#8571) 2020-10-05 20:16:09 -05:00
test-servers.tf Allow consul version/consul download url to be inputted via Terraform (#9267) 2020-12-11 13:11:14 -06:00
user-data-client.sh Allow consul version/consul download url to be inputted via Terraform (#9267) 2020-12-11 13:11:14 -06:00
user-data-server.sh Allow consul version/consul download url to be inputted via Terraform (#9267) 2020-12-11 13:11:14 -06:00
variables.tf Allow consul version/consul download url to be inputted via Terraform (#9267) 2020-12-11 13:11:14 -06:00

README.md

Terraform Consul Load Testing

How to use

  1. Build an image with the desired Consul version and a loadtest image in the Packer folder here.
  2. Create your own vars.tfvars file in this directory.
  3. Place the appropriate AMI IDs in the consul_ami_id and test_server_ami variables, here is an example of a vars.tfvars:
vpc_name             = "consul-test-vpc"
vpc_cidr             = "11.0.0.0/16"
public_subnet_cidrs  = ["11.0.1.0/24", "11.0.3.0/24"]
private_subnet_cidrs = ["11.0.2.0/24"]
vpc_az               = ["us-east-2a", "us-east-2b"]
test_instance_type   = "t2.micro"

## This is found from building the image in packer/loadtest-ami
test_server_ami      = "ami-0ad7711e837ebe166"
cluster_name         = "ctest"
test_public_ip       = "true"
instance_type        = "t2.micro"
ami_owners           = ["******"]

## This is found from building the image in packer/consul-ami
consul_ami_id        = "ami-016d80ff5472346f0"

If consul_version or consul_download_url is not set within the Terraform variables it will default to utilziing Consul 1.9.0

  1. AWS Variables are set off of environment variables. Make sure to export nessecary variables shown here.
  2. Run terraform plan -var-file=vars.tfvars, and then terraform apply -var-file=vars.tfvars when ready.
  3. Upon completion k6 should run and push metrics to desired Datadog dashboard.

Customization

All customization for infrastructure that is available can be found by looking through the variables.tf file. However, if customization of tests is desired then the start-k6.sh leverages user-data to place a puts_script.js onto the loadtest servers for k6 to run. This can be customized.

How to SSH

After terraform apply is ran Terraform should create a keys/ directory which will give access to all instances created.