From 80dde5d6c280f5e4581da50c7d3931e6bd42c2d4 Mon Sep 17 00:00:00 2001 From: Lens0021 / Leslie Date: Sat, 2 Mar 2024 07:20:25 +0900 Subject: [PATCH] tf: Replace deprecated nomad_volume (#206) --- terraform/mediawiki.tf | 4 ++-- terraform/volumes.tf | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/terraform/mediawiki.tf b/terraform/mediawiki.tf index 9bb0eef..7ad36af 100644 --- a/terraform/mediawiki.tf +++ b/terraform/mediawiki.tf @@ -1,7 +1,7 @@ resource "nomad_job" "mysql" { depends_on = [ data.nomad_plugin.ebs, - nomad_volume.mysql, + nomad_csi_volume_registration.mysql, ] jobspec = file("../jobs/mysql.nomad") @@ -38,7 +38,7 @@ resource "nomad_job" "fastcgi" { resource "nomad_job" "http" { depends_on = [ data.nomad_plugin.ebs, - nomad_volume.caddycerts, + nomad_csi_volume_registration.caddycerts, ] jobspec = file("../jobs/http.nomad") diff --git a/terraform/volumes.tf b/terraform/volumes.tf index 26c4b4c..0bf06fd 100644 --- a/terraform/volumes.tf +++ b/terraform/volumes.tf @@ -19,9 +19,12 @@ data "nomad_plugin" "ebs" { wait_for_healthy = true } -resource "nomad_volume" "mysql" { +import { + id = "mysql@default" + to = nomad_csi_volume_registration.mysql +} +resource "nomad_csi_volume_registration" "mysql" { depends_on = [data.nomad_plugin.ebs] - type = "csi" plugin_id = "aws-ebs0" volume_id = "mysql" name = "mysql" @@ -33,9 +36,12 @@ resource "nomad_volume" "mysql" { } } -resource "nomad_volume" "caddycerts" { +import { + id = "caddycerts@default" + to = nomad_csi_volume_registration.caddycerts +} +resource "nomad_csi_volume_registration" "caddycerts" { depends_on = [data.nomad_plugin.ebs] - type = "csi" plugin_id = "aws-ebs0" volume_id = "caddycerts" name = "caddycerts"