Compare commits

...

4 Commits

2 changed files with 5 additions and 10 deletions

13
main.tf
View File

@ -2,26 +2,24 @@
resource "nomad_job" "this" { resource "nomad_job" "this" {
for_each = var.jobs for_each = var.jobs
depends_on = [ depends_on = [
nomad_external_volume.this, nomad_csi_volume.this,
nomad_csi_volume_registration.this,
consul_key_prefix.this, consul_key_prefix.this,
# consul_config_entry.this
consul_intention.this consul_intention.this
] ]
jobspec = file("${each.value}") jobspec = file(each.value)
purge_on_destroy = true purge_on_destroy = true
hcl2 { hcl2 {
enabled = true
allow_fs = true allow_fs = true
} }
} }
resource "nomad_external_volume" "this" { resource "nomad_csi_volume" "this" {
for_each = var.volumes for_each = var.volumes
volume_id = each.key volume_id = each.key
name = each.key name = each.key
type = each.value.type
plugin_id = each.value.plugin_id plugin_id = each.value.plugin_id
namespace = each.value.namespace namespace = each.value.namespace
capacity_min = each.value.capacity_min capacity_min = each.value.capacity_min
@ -34,13 +32,12 @@ resource "nomad_external_volume" "this" {
secrets = sensitive(each.value.secrets) secrets = sensitive(each.value.secrets)
} }
resource "nomad_volume" "this" { resource "nomad_csi_volume_registration" "this" {
for_each = var.nfs_volumes for_each = var.nfs_volumes
volume_id = each.key volume_id = each.key
external_id = each.key external_id = each.key
name = each.key name = each.key
type = each.value.type
plugin_id = each.value.plugin_id plugin_id = each.value.plugin_id
namespace = each.value.namespace namespace = each.value.namespace
capability { capability {

View File

@ -7,7 +7,6 @@ variable "jobs" {
variable "volumes" { variable "volumes" {
type = map(object({ type = map(object({
type = string
plugin_id = string plugin_id = string
namespace = string namespace = string
capacity_min = string capacity_min = string
@ -22,7 +21,6 @@ variable "volumes" {
variable "nfs_volumes" { variable "nfs_volumes" {
type = map(object({ type = map(object({
type = string
plugin_id = string plugin_id = string
namespace = string namespace = string
capability = map(string) capability = map(string)