open-nomad/e2e/terraform
2020-01-27 16:28:25 -05:00
..
packer e2e: packer builds should not be public (#6998) 2020-01-27 16:28:25 -05:00
shared e2e: update framework to allow deploying Nomad (#6969) 2020-01-22 08:48:52 -05:00
.gitignore Infrastructure for Windows e2e testing (#6584) 2019-11-19 11:06:10 -05:00
compute.tf e2e: update framework to allow deploying Nomad (#6969) 2020-01-22 08:48:52 -05:00
iam.tf e2e: upgrade terraform to 0.12.x (#6489) 2019-10-14 11:27:08 -04:00
main.tf e2e: add a Windows client to test runner (#6735) 2019-11-25 13:31:00 -05:00
network.tf e2e: upgrade terraform to 0.12.x (#6489) 2019-10-14 11:27:08 -04:00
provisioning.tf e2e: update framework to allow deploying Nomad (#6969) 2020-01-22 08:48:52 -05:00
README.md e2e: document e2e provisioning process (#6976) 2020-01-22 16:55:17 -05:00
terraform.tfvars e2e: document e2e provisioning process (#6976) 2020-01-22 16:55:17 -05:00
versions.tf e2e: upgrade terraform to 0.12.x (#6489) 2019-10-14 11:27:08 -04:00

Terraform infrastructure

This folder contains terraform resources for provisioning EC2 instances on AWS to use as the target of end-to-end tests.

Terraform provisions the AWS infrastructure only, whereas the Nomad cluster is deployed to that infrastructure by the e2e framework. Terraform's output will include a provisioning stanza that can be written to a JSON file used by the e2e framework's provisioning step.

You can use Terraform to output the provisioning parameter JSON file the e2e framework uses by setting the nomad_sha variable.

Setup

You'll need Terraform 0.12+, as well as AWS credentials (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) to create the Nomad cluster. Use envchain to store your AWS credentials.

Optionally, edit the terraform.tfvars file to change the number of Linux clients, Windows clients, or the Nomad build. You'll usually want to have the nomad_sha variable set here (or via the TF_VAR_nomad_sha env var) so that terraform output provisioning is populated with the build you want.

region               = "us-east-1"
instance_type        = "t2.medium"
server_count         = "3"
client_count         = "4"
windows_client_count = "1"

# alternatively, set this via env var: TF_VAR_nomad_sha
# nomad_sha            = ""

Run Terraform apply to deploy the infrastructure:

cd e2e/terraform/
TF_VAR_nomad_sha=<nomad_sha> envchain nomadaws terraform apply

Outputs

After deploying the infrastructure, you can get connection information about the cluster:

  • $(terraform output environment) will set your current shell's NOMAD_ADDR and CONSUL_HTTP_ADDR to point to one of the cluster's server nodes, and set the NOMAD_E2E variable.
  • terraform output servers will output the list of server node IPs.
  • terraform output linux_clients will output the list of Linux client node IPs.
  • terraform output windows_clients will output the list of Windows client node IPs.
  • terraform output provisioning | jq . will output the JSON used by the e2e framework for provisioning.

SSH

You can use Terraform outputs above to access nodes via ssh:

ssh -i keys/nomad-e2e-*.pem ubuntu@${EC2_IP_ADDR}

The Windows client runs OpenSSH for convenience, but has a different user and will drop you into a Powershell shell instead of bash:

ssh -i keys/nomad-e2e-*.pem Administrator@${EC2_IP_ADDR}

Teardown

The terraform state file stores all the info, so the nomad_sha doesn't need to be valid during teardown.

cd e2e/terraform/
envchain nomadaws TF_VAR_nomad_sha=yyyzzz terraform destroy