Overview

Nomatron is in early access. Some advanced workflows may not be covered in the public docs.

A Nomatron template is an HCL file, usually stored in Git as something like nomatron.tpl, that Nomatron renders into a concrete Nomad jobspec for a specific environment.

Templates are useful when:

  • the same workload shape needs to be reused across multiple services;
  • different environments should share structure but vary in controlled ways;
  • platform teams want to encode deployment defaults once instead of repeating them per job; or
  • environment promotion should reuse the same template while resolving different values.

How Rendering Works

At a high level, Nomatron does four things when it renders a template:

  1. loads the template file from Git or from direct render input;
  2. parses the file as HCL;
  3. discovers NOMATRON_VAR_... references inside the template; and
  4. resolves those references against the variables available to the job and environment being rendered.

If rendering succeeds, the result is concrete HCL that can be planned and applied. If required values are missing, Nomatron reports which references could not be resolved.

What A Template Usually Contains

A template usually contains:

  • the Nomad job structure you want to reuse;
  • variable references for values that should change between services, scopes, or environments; and
  • any platform-standard defaults you want every deployment to inherit.

For example, a template might keep the job shape fixed while allowing the image tag, CPU, memory, datacenters, or environment variables to vary.

hcl
job "demo" {
  datacenters = NOMATRON_VAR_GLOBAL_DATACENTERS

  group "web" {
    count = NOMATRON_VAR_APP_JOB_COUNT

    task "app" {
      driver = "docker"

      config {
        image = "${NOMATRON_VAR_APP_IMAGE_REPOSITORY}:${NOMATRON_VAR_IMAGE_TAG}"
      }

      resources {
        cpu    = NOMATRON_VAR_APP_JOB_CPU
        memory = NOMATRON_VAR_APP_JOB_MEMORY
      }
    }
  }
}

Where The Variables Come From

Template values come from Nomatron variables, not from ad hoc string replacement in the file itself.

Those variables can exist at different scopes:

  • global;
  • organization;
  • app; or
  • app job.

Nomatron also supports environment-specific overrides, so the same template can render one value for dev and another for staging or prod.

The easiest way to think about template authoring is:

  • the template defines the reusable deployment structure;
  • variables define the approved inputs to that structure; and
  • environments pick which resolved values should apply for a specific render.

That separation is what makes template-backed jobs predictable and promotable.

Next Steps

The rest of this section explains:

  • how variable references work inside the file;
  • how to define variables correctly in Nomatron; and
  • how to preview and debug template output during authoring.