diff --git a/.gitignore b/.gitignore index 995fa494afc..2fc7f49083f 100644 --- a/.gitignore +++ b/.gitignore @@ -137,3 +137,10 @@ tools/missing/missing # allow security scanner file !scan.hcl + +# generated variables for upgrade tests +enos.vars.hcl +enos/modules/*/*.tfvars + +# local license files +*.hclic diff --git a/e2e/terraform/compute.tf b/e2e/terraform/compute.tf index af4254825a9..9788ae17dbf 100644 --- a/e2e/terraform/compute.tf +++ b/e2e/terraform/compute.tf @@ -39,6 +39,8 @@ resource "aws_instance" "client_ubuntu_jammy_amd64" { } } + + resource "aws_instance" "client_windows_2016_amd64" { ami = data.aws_ami.windows_2016_amd64[0].image_id instance_type = var.instance_type @@ -48,7 +50,7 @@ resource "aws_instance" "client_windows_2016_amd64" { iam_instance_profile = data.aws_iam_instance_profile.nomad_e2e_cluster.name availability_zone = var.availability_zone - user_data = file("${path.root}/userdata/windows-2016.ps1") + user_data = file("${path.module}/userdata/windows-2016.ps1") # Instance tags tags = { diff --git a/e2e/terraform/consul-clients.tf b/e2e/terraform/consul-clients.tf index 33a59e8cb42..2d6501c9600 100644 --- a/e2e/terraform/consul-clients.tf +++ b/e2e/terraform/consul-clients.tf @@ -48,7 +48,7 @@ resource "local_sensitive_file" "consul_agents_cert" { resource "random_uuid" "consul_agent_token" {} resource "local_sensitive_file" "consul_agent_config_file" { - content = templatefile("etc/consul.d/clients.hcl", { + content = templatefile("${path.module}/provision-nomad/etc/consul.d/clients.hcl", { token = "${random_uuid.consul_agent_token.result}" autojoin_value = "auto-join-${local.random_name}" }) @@ -61,7 +61,7 @@ resource "local_sensitive_file" "consul_agent_config_file" { resource "random_uuid" "consul_token_for_nomad" {} resource "local_sensitive_file" "nomad_client_config_for_consul" { - content = templatefile("etc/nomad.d/client-consul.hcl", { + content = templatefile("${path.module}/provision-nomad/etc/nomad.d/client-consul.hcl", { token = "${random_uuid.consul_token_for_nomad.result}" client_service_name = "client-${local.random_name}" server_service_name = "server-${local.random_name}" @@ -71,7 +71,7 @@ resource "local_sensitive_file" "nomad_client_config_for_consul" { } resource "local_sensitive_file" "nomad_server_config_for_consul" { - content = templatefile("etc/nomad.d/server-consul.hcl", { + content = templatefile("${path.module}/provision-nomad/etc/nomad.d/server-consul.hcl", { token = "${random_uuid.consul_token_for_nomad.result}" client_service_name = "client-${local.random_name}" server_service_name = "server-${local.random_name}" diff --git a/e2e/terraform/consul-servers.tf b/e2e/terraform/consul-servers.tf index eaffbc65697..a0fbfdb98e2 100644 --- a/e2e/terraform/consul-servers.tf +++ b/e2e/terraform/consul-servers.tf @@ -15,7 +15,7 @@ resource "local_sensitive_file" "consul_initial_management_token" { } resource "local_sensitive_file" "consul_server_config_file" { - content = templatefile("etc/consul.d/servers.hcl", { + content = templatefile("${path.module}/provision-nomad/etc/consul.d/servers.hcl", { management_token = "${random_uuid.consul_initial_management_token.result}" token = "${random_uuid.consul_agent_token.result}" nomad_token = "${random_uuid.consul_token_for_nomad.result}" @@ -69,7 +69,7 @@ resource "local_sensitive_file" "consul_server_cert" { # if consul_license is unset, it'll be a harmless empty license file resource "local_sensitive_file" "consul_environment" { - content = templatefile("etc/consul.d/.environment", { + content = templatefile("${path.module}/provision-nomad/etc/consul.d/.environment", { license = var.consul_license }) filename = "uploads/shared/consul.d/.environment" @@ -117,7 +117,7 @@ resource "null_resource" "upload_consul_server_configs" { destination = "/tmp/consul_server.hcl" } provisioner "file" { - source = "etc/consul.d/consul-server.service" + source = "${path.module}/provision-nomad/etc/consul.d/consul-server.service" destination = "/tmp/consul.service" } } diff --git a/e2e/terraform/ecs.tf b/e2e/terraform/ecs.tf index 9c1c27e72ca..98ea555548d 100644 --- a/e2e/terraform/ecs.tf +++ b/e2e/terraform/ecs.tf @@ -8,7 +8,7 @@ resource "aws_ecs_cluster" "nomad_rtd_e2e" { resource "aws_ecs_task_definition" "nomad_rtd_e2e" { family = "nomad-rtd-e2e" - container_definitions = file("ecs-task.json") + container_definitions = file("${path.module}/ecs-task.json") # Don't need a network for e2e tests network_mode = "awsvpc" diff --git a/e2e/terraform/hcp_vault.tf b/e2e/terraform/hcp_vault.tf index b148f25ef99..4bfbe9efcb3 100644 --- a/e2e/terraform/hcp_vault.tf +++ b/e2e/terraform/hcp_vault.tf @@ -16,7 +16,7 @@ data "hcp_vault_cluster" "e2e_shared_vault" { # between concurrent E2E clusters resource "vault_policy" "nomad" { name = "${local.random_name}-nomad-server" - policy = templatefile("${path.root}/etc/acls/vault/nomad-policy.hcl", { + policy = templatefile("${path.module}/provision-nomad/etc/acls/vault/nomad-policy.hcl", { role = "nomad-tasks-${local.random_name}" }) } @@ -42,7 +42,7 @@ resource "vault_token_auth_backend_role" "nomad_cluster" { # Nomad agent configuration for Vault resource "local_sensitive_file" "nomad_config_for_vault" { - content = templatefile("etc/nomad.d/vault.hcl", { + content = templatefile("${path.module}/provision-nomad/etc/nomad.d/vault.hcl", { token = vault_token.nomad.client_token url = data.hcp_vault_cluster.e2e_shared_vault.vault_private_endpoint_url namespace = var.hcp_vault_namespace diff --git a/e2e/terraform/nomad-acls.tf b/e2e/terraform/nomad-acls.tf index fbe3d7651b9..b5cce557f3e 100644 --- a/e2e/terraform/nomad-acls.tf +++ b/e2e/terraform/nomad-acls.tf @@ -23,7 +23,7 @@ resource "null_resource" "bootstrap_nomad_acls" { data "local_sensitive_file" "nomad_token" { depends_on = [null_resource.bootstrap_nomad_acls] - filename = "${path.root}/keys/nomad_root_token" + filename = "${path.module}/keys/nomad_root_token" } # push the token out to the servers for humans to use. @@ -36,8 +36,8 @@ locals { cat <