Nomad Job nomad_job

The nomad_job resource allows you to apply one or more Nomad job files to a cluster.

Jumppad monitors changes to the jobs defined in the paths property and automatically recreates this resource when jumppad up is called.

Properties

  • Name
    cluster
    Type
    (nomad_cluster: )
    Required
    required
    Readonly
    Description

    The reference to a cluster to apply the jobs to. Nomad jobs are only applied when the referenced cluster is created and healthy.

      resource "nomad_job" "example" {
        cluster = resource.nomad_cluster.dev
        ...
      }
    
  • Name
    paths
    Type
    ([]string: [])
    Required
    required
    Readonly
    Description

    Paths to the Nomad job files to apply to the cluster.

  • Name
    health_check
    Type
    (health_check: {})
    Required
    Readonly
    Description

    Optional health check to perform after the jobs have been applied, this resource will not complete until the health checks are passing.


health_check

A health_check stanza allows the definition of a health check which must pass before the resource is marked as successfully created.

health_check {
  timeout = "60s"
  jobs = ["example"]
}
  • Name
    timeout
    Type
    (duration: )
    Required
    required
    Readonly
    Description

    The maximum duration to wait before marking the health check as failed. Expressed as a Go duration, e.g. 1s = 1 second, 100ms = 100 milliseconds.

  • Name
    jobs
    Type
    ([]string: [])
    Required
    required
    Readonly
    Description

    An array of nomad jobs that must be marked as "Running" by the Nomad server.

Meta Properties

In addition to the main properties, all resources have meta properties, such as the id of the resource. To see the list of these properties please see the Meta Properties section in the documentation /docs/resources/meta.

Examples

resource "nomad_cluster" "dev" {
  network {
    id = resource.network.cloud.meta.id
  }
}

resource "nomad_job" "example" {
  cluster = resource.nomad_cluster.dev.meta.id

  paths = ["./app_config/example1.nomad"]

  health_check {
    timeout    = "60s"
    nomad_jobs = ["example"]
  }
}