e2e: fix provisioning when ACLs and TLS enabled; no nightly TLS.

This commit is contained in:
James Rasell 2021-09-16 17:15:41 +02:00
parent bbae221c8c
commit 30273d9256
No known key found for this signature in database
GPG Key ID: AA7D460F5C8377AA
2 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,10 @@
# So we run a bootstrapping script and write our management token into a file
# that we read in for the output of $(terraform output environment) later.
locals {
nomad_env = var.tls ? "NOMAD_ADDR=https://${aws_instance.server.0.public_ip}:4646 NOMAD_CACERT=keys/tls_ca.crt NOMAD_CLIENT_CERT=keys/tls_api_client.crt NOMAD_CLIENT_KEY=keys/tls_api_client.key" : "NOMAD_ADDR=http://${aws_instance.server.0.public_ip}:4646"
}
resource "null_resource" "bootstrap_nomad_acls" {
depends_on = [module.nomad_server]
triggers = {
@ -20,7 +24,7 @@ resource "null_resource" "bootstrap_nomad_acls" {
# so that we can read it into the data.local_file later. If not set,
# ensure that it's empty.
data "template_file" "bootstrap_nomad_script" {
template = var.nomad_acls ? "NOMAD_ADDR=http://${aws_instance.server.0.public_ip}:4646 ./scripts/bootstrap-nomad.sh" : "mkdir -p ${path.root}/keys; echo > ${path.root}/keys/nomad_root_token"
template = var.nomad_acls ? "${local.nomad_env} ./scripts/bootstrap-nomad.sh" : "mkdir -p ${path.root}/keys; echo > ${path.root}/keys/nomad_root_token"
}
data "local_file" "nomad_token" {

View File

@ -8,6 +8,7 @@ nomad_enterprise = true
nomad_acls = true
vault = true
volumes = true
tls = false
# required to avoid picking up defaults from terraform.tfvars file
nomad_version = "" # default version for deployment