open-nomad/e2e/terraform/provisioning.tf
Tim Gross cd1c6173f4 csi: e2e tests for EBS and EFS plugins (#7343)
This changeset provides two basic e2e tests for CSI plugins targeting
common AWS use cases.

The EBS test launches the EBS plugin (controller + nodes) and registers
an EBS volume as a Nomad CSI volume. We deploy a job that writes to
the volume, stop that job, and reuse the volume for another job which
should be able to read the data written by the first job.

The EFS test launches the EFS plugin (nodes-only) and registers an EFS
volume as a Nomad CSI volume. We deploy a job that writes to the
volume, stop that job, and reuse the volume for another job which
should be able to read the data written by the first job.

The writer jobs mount the CSI volume at a location within the alloc
dir.
2020-03-23 13:59:18 -04:00

103 lines
3.3 KiB
HCL

# outputs used for E2E testing and provisioning
output "environment" {
description = "get connection config by running: $(terraform output environment)"
value = <<EOM
export NOMAD_ADDR=http://${aws_instance.server[0].public_ip}:4646
export CONSUL_HTTP_ADDR=http://${aws_instance.server[0].public_ip}:8500
export NOMAD_E2E=1
EOM
}
output "volumes" {
description = "get volume IDs needed to register volumes for CSI testing."
value = jsonencode(
{
"ebs_volume" : aws_ebs_volume.csi.id,
"efs_volume" : aws_efs_file_system.csi.id,
})
}
output "provisioning" {
description = "output to a file to be use w/ E2E framework -provision.terraform"
value = jsonencode(
{
"servers" : [for server in aws_instance.server.* :
{
"runner" : {
"key" : abspath(module.keys.private_key_filepath),
"user" : "ubuntu",
"host" : "${server.public_ip}",
"port" : 22
},
"deployment" : {
"nomad_sha" : var.nomad_sha,
"platform" : "linux_amd64",
"remote_binary_path" : "/usr/local/bin/nomad",
"bundles" : [
{
"source" : abspath("./shared"),
"destination" : "/ops/shared"
}
],
"steps" : [
"sudo chmod +x /ops/shared/config/provision-server.sh",
"sudo /ops/shared/config/provision-server.sh aws ${var.server_count} 'indexed/server-${index(aws_instance.server, server)}.hcl'"
],
}
}
],
"clients" : concat([for client in aws_instance.client_linux.* :
{
"runner" : {
"key" : abspath(module.keys.private_key_filepath),
"user" : "ubuntu",
"host" : "${client.public_ip}",
"port" : 22
},
"deployment" : {
"nomad_sha" : var.nomad_sha,
"platform" : "linux_amd64",
"remote_binary_path" : "/usr/local/bin/nomad",
"bundles" : [
{
"source" : abspath("./shared"),
"destination" : "/ops/shared"
}
],
"steps" : [
"sudo chmod +x /ops/shared/config/provision-client.sh",
"sudo /ops/shared/config/provision-client.sh aws 'indexed/client-${index(aws_instance.client_linux, client)}.hcl'"
],
}
}
],
[for client in aws_instance.client_windows.* :
{
"runner" : {
"key" : abspath(module.keys.private_key_filepath),
"user" : "Administrator",
"host" : "${client.public_ip}",
"port" : 22
},
"deployment" : {
"nomad_sha" : var.nomad_sha,
"platform" : "windows_amd64",
# need to use the / here for golang filepath handling to work
# on the Unix test runner environment
"remote_binary_path" : "C:/opt/nomad.exe",
"bundles" : [
{
"source" : abspath("./shared"),
"destination" : "C:/ops/shared"
}
],
"steps" : [
"& C:\\ops\\shared\\config\\provision-windows-client.ps1 -Cloud aws -Index 1"
]
}
}
])
})
}