mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
Adds a `nomad_acls` flag to our Terraform stack that bootstraps Nomad ACLs via a `local-exec` provider. There's no way to set the `NOMAD_TOKEN` in the Nomad TF provider if we're bootstrapping in the same Terraform stack, so instead of using `resource.nomad_acl_token`, we also bootstrap a wide-open anonymous policy. The resulting management token is exported as an environment var with `$(terraform output environment)` and tests that want stricter ACLs will be able to write them using that token. This should also provide a basis to do similar work with Consul ACLs in the future.
45 lines
1.0 KiB
HCL
45 lines
1.0 KiB
HCL
output "servers" {
|
|
value = aws_instance.server.*.public_ip
|
|
}
|
|
|
|
output "linux_clients" {
|
|
value = aws_instance.client_linux.*.public_ip
|
|
}
|
|
|
|
output "windows_clients" {
|
|
value = aws_instance.client_windows.*.public_ip
|
|
}
|
|
|
|
output "message" {
|
|
value = <<EOM
|
|
Your cluster has been provisioned! To prepare your environment, run:
|
|
|
|
$(terraform output environment)
|
|
|
|
Then you can run tests from the e2e directory with:
|
|
|
|
go test -v .
|
|
|
|
ssh into servers with:
|
|
|
|
ssh -i keys/${local.random_name}.pem ubuntu@${aws_instance.server[0].public_ip}
|
|
|
|
ssh into clients with:
|
|
|
|
%{for ip in aws_instance.client_linux.*.public_ip~}
|
|
ssh -i keys/${local.random_name}.pem ubuntu@${ip}
|
|
%{endfor~}
|
|
|
|
EOM
|
|
}
|
|
|
|
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
|
|
export NOMAD_TOKEN=${data.local_file.nomad_token.content}
|
|
EOM
|
|
}
|