- manage nomad jobs - create makefile - create gitignore - manage terragrunt environments - add build jobs
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# Dynamically load all job configurations from the jobs/ folder
|
||||
resource "nomad_job" "app" {
|
||||
for_each = toset(var.job_files)
|
||||
|
||||
jobspec = file("../../${path.module}/jobs/${each.value}.hcl")
|
||||
}
|
||||
|
||||
resource "nomad_acl_policy" "policies" {
|
||||
for_each = toset(var.policy_files)
|
||||
|
||||
name = each.value
|
||||
rules_hcl = file("../../${path.module}/policies/${each.value}")
|
||||
}
|
||||
|
||||
resource "nomad_acl_role" "roles" {
|
||||
for_each = toset(var.policy_files)
|
||||
|
||||
name = "${each.value}_role"
|
||||
|
||||
policy {
|
||||
name = each.value
|
||||
}
|
||||
}
|
||||
|
||||
resource "nomad_acl_token" "tokens" {
|
||||
for_each = toset(var.policy_files)
|
||||
|
||||
name = "${each.value}_token"
|
||||
type = "client"
|
||||
policies = [each.value]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#variable "nomad_token" {
|
||||
# description = "The Nomad API token"
|
||||
# type = string
|
||||
#}
|
||||
|
||||
variable "job_files" {
|
||||
description = "List of Nomad job files to deploy"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "policy_files" {
|
||||
description = "List of policy files to create Nomad ACL policies"
|
||||
type = list(string)
|
||||
}
|
||||
Reference in New Issue
Block a user