2020-01-22 13:48:52 +00:00
|
|
|
# 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
|
|
|
|
}
|
|
|
|
|
2020-03-16 12:53:04 +00:00
|
|
|
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,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-01-22 13:48:52 +00:00
|
|
|
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"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
])
|
|
|
|
})
|
|
|
|
}
|