From 082bad9837d7756d19136856db76c1ee71f25422 Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Tue, 22 Aug 2023 18:32:17 +0200 Subject: [PATCH 1/3] replace nomad_volume and nomad_external_volume with new resources --- main.tf | 6 ++---- variables.tf | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/main.tf b/main.tf index b61b9e3..8b9090b 100644 --- a/main.tf +++ b/main.tf @@ -16,12 +16,11 @@ resource "nomad_job" "this" { } } -resource "nomad_external_volume" "this" { +resource "nomad_csi_volume" "this" { for_each = var.volumes volume_id = each.key name = each.key - type = each.value.type plugin_id = each.value.plugin_id namespace = each.value.namespace capacity_min = each.value.capacity_min @@ -34,13 +33,12 @@ resource "nomad_external_volume" "this" { secrets = sensitive(each.value.secrets) } -resource "nomad_volume" "this" { +resource "nomad_csi_volume_registration" "this" { for_each = var.nfs_volumes volume_id = each.key external_id = each.key name = each.key - type = each.value.type plugin_id = each.value.plugin_id namespace = each.value.namespace capability { diff --git a/variables.tf b/variables.tf index f5162e1..d1ba18f 100644 --- a/variables.tf +++ b/variables.tf @@ -7,7 +7,6 @@ variable "jobs" { variable "volumes" { type = map(object({ - type = string plugin_id = string namespace = string capacity_min = string @@ -22,7 +21,6 @@ variable "volumes" { variable "nfs_volumes" { type = map(object({ - type = string plugin_id = string namespace = string capability = map(string) -- 2.45.2 From 3804662ecc3bb34bc0dd81d69add525a7cb830ef Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Tue, 22 Aug 2023 18:47:37 +0200 Subject: [PATCH 2/3] replace job dependencies --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 8b9090b..c9f42a8 100644 --- a/main.tf +++ b/main.tf @@ -2,13 +2,13 @@ resource "nomad_job" "this" { for_each = var.jobs depends_on = [ - nomad_external_volume.this, + nomad_csi_volume.this, + nomad_csi_volume_registration.this, consul_key_prefix.this, - # consul_config_entry.this consul_intention.this ] - jobspec = file("${each.value}") + jobspec = file(each.value) purge_on_destroy = true hcl2 { enabled = true -- 2.45.2 From fb2f55efa87138779ab2ac9a2b447ffed398840e Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Tue, 22 Aug 2023 18:48:55 +0200 Subject: [PATCH 3/3] remove hcl parsing reference as it is standard --- main.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/main.tf b/main.tf index c9f42a8..4e2b9a5 100644 --- a/main.tf +++ b/main.tf @@ -11,7 +11,6 @@ resource "nomad_job" "this" { jobspec = file(each.value) purge_on_destroy = true hcl2 { - enabled = true allow_fs = true } } -- 2.45.2