terraform-nomad/shared/modules.tf
Ben Vincent 977d879b08
Some checks failed
Build / build (pull_request) Failing after 35s
feat: initial setup
- manage nomad jobs
- create makefile
- create gitignore
- manage terragrunt environments
- add build jobs
2024-12-28 22:24:54 +11:00

32 lines
674 B
HCL

# 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]
}