From 630c487b4e77bc00405324e510a3425266a665a3 Mon Sep 17 00:00:00 2001 From: lens0021 Date: Mon, 7 Oct 2024 02:54:57 +0900 Subject: [PATCH] Remove Blue resources --- terraform/backupbot.tf | 2 +- terraform/base.tf | 12 ------------ terraform/mediawiki.tf | 37 +------------------------------------ terraform/volumes.tf | 32 -------------------------------- 4 files changed, 2 insertions(+), 81 deletions(-) diff --git a/terraform/backupbot.tf b/terraform/backupbot.tf index e2dc105..73fd2f0 100644 --- a/terraform/backupbot.tf +++ b/terraform/backupbot.tf @@ -1,6 +1,6 @@ resource "nomad_job" "backupbot" { provider = nomad.green - count = 0 + count = 1 depends_on = [nomad_job.mysql_green] detach = false diff --git a/terraform/base.tf b/terraform/base.tf index ea8630a..9efd024 100644 --- a/terraform/base.tf +++ b/terraform/base.tf @@ -1,8 +1,3 @@ -variable "nomad_token" { - type = string - sensitive = true -} - variable "nomad_green_token" { type = string sensitive = true @@ -42,13 +37,6 @@ data "terraform_remote_state" "aws" { } } -provider "nomad" { - address = "http://${data.terraform_remote_state.aws.outputs.nomad_blue_public_ip}:4646" - secret_id = var.nomad_token - # Should be specified explicitly because of the bug https://github.com/femiwiki/nomad/issues/99 - region = "global" -} - provider "nomad" { alias = "green" address = "http://${data.terraform_remote_state.aws.outputs.nomad_green_public_ip}:4646" diff --git a/terraform/mediawiki.tf b/terraform/mediawiki.tf index 7c09782..b282c3b 100644 --- a/terraform/mediawiki.tf +++ b/terraform/mediawiki.tf @@ -15,15 +15,6 @@ resource "nomad_job" "mysql_green" { } } -resource "nomad_job" "memcached" { - jobspec = file("../jobs/memcached.nomad") - detach = false - - hcl2 { - allow_fs = true - } -} - resource "nomad_job" "memcached_green" { provider = nomad.green jobspec = file("../jobs/memcached.nomad") @@ -37,23 +28,10 @@ resource "nomad_job" "memcached_green" { } } -resource "nomad_job" "fastcgi" { - depends_on = [ - nomad_job.memcached, - ] - - jobspec = file("../jobs/fastcgi.nomad") - detach = false - - hcl2 { - allow_fs = true - } -} - resource "nomad_job" "fastcgi_green" { provider = nomad.green depends_on = [ - nomad_job.memcached, + nomad_job.memcached_green, ] jobspec = file("../jobs/fastcgi.nomad") @@ -68,19 +46,6 @@ resource "nomad_job" "fastcgi_green" { } } -resource "nomad_job" "http" { - depends_on = [ - nomad_csi_volume_registration.caddycerts, - ] - - jobspec = file("../jobs/http.nomad") - detach = false - - hcl2 { - allow_fs = true - } -} - resource "nomad_job" "http_green" { provider = nomad.green # TODO Replace EBS CSI with S3 CSI or something diff --git a/terraform/volumes.tf b/terraform/volumes.tf index 6b4ae9a..794772d 100644 --- a/terraform/volumes.tf +++ b/terraform/volumes.tf @@ -1,19 +1,3 @@ -resource "nomad_job" "plugin-ebs-controller" { - jobspec = file("../jobs/plugin-ebs-controller.nomad") - - hcl2 { - allow_fs = true - } -} - -resource "nomad_job" "plugin-ebs-nodes" { - jobspec = file("../jobs/plugin-ebs-nodes.nomad") - - hcl2 { - allow_fs = true - } -} - resource "nomad_job" "plugin_ebs_controller_green" { provider = nomad.green jobspec = file("../jobs/plugin-ebs-controller.nomad") @@ -45,22 +29,6 @@ resource "nomad_csi_volume_registration" "mysql_green" { } } -import { - id = "caddycerts@default" - to = nomad_csi_volume_registration.caddycerts -} -resource "nomad_csi_volume_registration" "caddycerts" { - plugin_id = "aws-ebs0" - volume_id = "caddycerts" - name = "caddycerts" - external_id = data.terraform_remote_state.aws.outputs.ebs_caddycerts_id - - capability { - access_mode = "single-node-writer" - attachment_mode = "file-system" - } -} - resource "nomad_csi_volume_registration" "caddycerts_green" { provider = nomad.green plugin_id = "aws-ebs0"