diff --git a/jobs/http.nomad b/jobs/http.nomad index 9f39665..043c935 100644 --- a/jobs/http.nomad +++ b/jobs/http.nomad @@ -4,11 +4,6 @@ variable "test" { default = false } -variable "test_nomad_public_ip" { - type = string - default = "" -} - locals { main = !var.test } @@ -96,9 +91,8 @@ job "http" { dynamic "env" { for_each = var.test ? [{}] : [] content { - CADDYPATH = "/etc/caddycerts" - FASTCGI_ADDR = var.test ? NOMAD_UPSTREAM_ADDR_fastcgi : "127.0.0.1:9000" - TEST_NOMAD_PUBLIC_IP = var.test_nomad_public_ip + CADDYPATH = "/etc/caddycerts" + FASTCGI_ADDR = var.test ? NOMAD_UPSTREAM_ADDR_fastcgi : "127.0.0.1:9000" } } diff --git a/terraform/base.tf b/terraform/base.tf index 242072a..2c5b32e 100644 --- a/terraform/base.tf +++ b/terraform/base.tf @@ -3,12 +3,12 @@ variable "nomad_token" { sensitive = true } -variable "test_nomad_token" { +variable "nomad_green_token" { type = string sensitive = true } -variable "test_consul_token" { +variable "consul_green_token" { type = string sensitive = true } @@ -50,9 +50,8 @@ provider "nomad" { } provider "nomad" { - alias = "test" - address = "http://${data.terraform_remote_state.aws.outputs.test_nomad_public_ip}:4646" - secret_id = var.test_nomad_token - consul_token = var.test_consul_token - region = "global" + alias = "green" + address = "http://${data.terraform_remote_state.aws.outputs.nomad_green_public_ip}:4646" + secret_id = var.nomad_green_token + region = "global" } diff --git a/terraform/mediawiki.tf b/terraform/mediawiki.tf index 4505f26..0852f94 100644 --- a/terraform/mediawiki.tf +++ b/terraform/mediawiki.tf @@ -21,8 +21,8 @@ resource "nomad_job" "memcached" { } } -resource "nomad_job" "test_memcached" { - provider = nomad.test +resource "nomad_job" "memcached_green" { + provider = nomad.green jobspec = file("../jobs/memcached.nomad") detach = false @@ -48,8 +48,8 @@ resource "nomad_job" "fastcgi" { } } -resource "nomad_job" "test_fastcgi" { - provider = nomad.test +resource "nomad_job" "fastcgi_green" { + provider = nomad.green depends_on = [ nomad_job.memcached, ] @@ -63,7 +63,7 @@ resource "nomad_job" "test_fastcgi" { test = true main_nomad_private_ip = data.terraform_remote_state.aws.outputs.nomad_private_ip mysql_password_mediawiki = var.mysql_password_mediawiki - test_nomad_public_ip = data.terraform_remote_state.aws.outputs.test_nomad_public_ip + test_nomad_public_ip = data.terraform_remote_state.aws.outputs.nomad_green_public_ip test_include_mysql = false } } @@ -83,11 +83,10 @@ resource "nomad_job" "http" { } } -resource "nomad_job" "test_http" { - provider = nomad.test +resource "nomad_job" "http_green" { + provider = nomad.green # TODO Replace EBS CSI with S3 CSI or something depends_on = [ - data.nomad_plugin.ebs_green, nomad_csi_volume_registration.caddycerts_green, ] @@ -97,8 +96,7 @@ resource "nomad_job" "test_http" { hcl2 { allow_fs = true vars = { - test = true - test_nomad_public_ip = data.terraform_remote_state.aws.outputs.test_nomad_public_ip + test = true } } } diff --git a/terraform/volumes.tf b/terraform/volumes.tf index b816023..c56a338 100644 --- a/terraform/volumes.tf +++ b/terraform/volumes.tf @@ -15,7 +15,7 @@ resource "nomad_job" "plugin-ebs-nodes" { } resource "nomad_job" "plugin_ebs_controller_green" { - provider = nomad.test + provider = nomad.green jobspec = file("../jobs/plugin-ebs-controller.nomad") hcl2 { @@ -24,7 +24,7 @@ resource "nomad_job" "plugin_ebs_controller_green" { } resource "nomad_job" "plugin_ebs_nodes_green" { - provider = nomad.test + provider = nomad.green jobspec = file("../jobs/plugin-ebs-nodes.nomad") hcl2 { @@ -37,12 +37,6 @@ data "nomad_plugin" "ebs" { wait_for_healthy = true } -data "nomad_plugin" "ebs_green" { - provider = nomad.test - plugin_id = "aws-ebs0" - wait_for_healthy = true -} - import { id = "mysql@default" to = nomad_csi_volume_registration.mysql @@ -78,8 +72,7 @@ resource "nomad_csi_volume_registration" "caddycerts" { } resource "nomad_csi_volume_registration" "caddycerts_green" { - provider = nomad.test - depends_on = [data.nomad_plugin.ebs_green] + provider = nomad.green plugin_id = "aws-ebs0" volume_id = "caddycerts_green" name = "caddycerts_green"