Common Resources
Nomatron is in early access. Some advanced workflows may not be covered in the public docs.
The provider supports a broad set of Nomatron resources, but in practice most teams start with a smaller, more predictable subset.
This page focuses on the resources that are usually the best fit for declarative management.
Platform And Identity Resources
These resources are a strong fit for Terraform because they tend to be long-lived and sensitive to change control.
Common examples include:
nomatron_organizationnomatron_usernomatron_groupnomatron_group_membernomatron_service_accountnomatron_rolenomatron_role_assignmentnomatron_organization_membernomatron_oidc_providernomatron_oidc_group_mapping
These are often the first resources teams move into Terraform because they define platform structure and access.
Cluster And Integration Resources
Terraform is also a good fit for stable connectivity definitions such as:
nomatron_nomad_clusternomatron_organization_nomad_clusternomatron_github_app_integrationnomatron_organization_github_app_integrationnomatron_network_agent
These resources usually change less often than day-to-day deployments, which makes them good candidates for declarative ownership.
Delivery Resources
The provider can also manage the Nomatron objects that shape application delivery:
nomatron_applicationnomatron_jobnomatron_environmentnomatron_variablenomatron_approval_policy
This is where Terraform becomes especially powerful for repeatable onboarding.
You can describe:
- the application and repository;
- the jobs it contains;
- the app environments it deploys through;
- the variables needed by those jobs and environments; and
- the approval policy and environment overrides that govern deployments.
Environments are app-scoped. A deployable app needs at least one environment before plans, applies, promotions, or speculative plans can run.
Example: Application And Job
resource "nomatron_application" "payments" {
org_name = "platform"
name = "Payments"
slug = "payments"
cluster_id = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
repo_url = "https://github.com/nomatron/payments"
git_provider = "github"
trigger_mode = "branch_commit"
ref = "main"
}
resource "nomatron_job" "web" {
org_name = "platform"
app_slug = nomatron_application.payments.slug
name = "Web"
slug = "web"
jobspec_path = "jobs/web.nomad.hcl"
jobspec_type = "hcl"
default_namespace = "payments"
is_primary = true
}trigger_mode is branch_commit (the default; deploys from pushes to ref) or tag (deploys from matching Git tags, configured with tag_pattern_type and tag_pattern). ref applies only to branch_commit.
Example: Environment
resource "nomatron_environment" "prod" {
org_name = "platform"
app_slug = "payments"
name = "Production"
slug = "prod"
cluster_id = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
namespace = "payments-prod"
priority = 100
}Example: App Approval Policy
resource "nomatron_approval_policy" "payments" {
org_name = "platform"
app_slug = nomatron_application.payments.slug
default_rule = {
required_approvals = 1
users = ["morgan.smith"]
groups = []
}
environment_rules = [
{
environment_id = nomatron_environment.prod.id
required_approvals = 2
users = ["morgan.smith", "jamie.lee"]
groups = ["bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"]
}
]
}default_rule is required. It sets required_approvals and, optionally, who can approve: users takes usernames and groups takes group IDs, such as nomatron_group.release_managers.id.
environment_rules is an optional list of overrides, one object per app environment. Each one names its environment with environment_id, the environment’s ID (here nomatron_environment.prod.id from the environment example above), and sets its own required_approvals, users and groups.
Environment rules are app environment overrides. They apply to both raw Nomad jobs and Nomatron template jobs.
Example: Sensitive Variable
resource "nomatron_variable" "db_password" {
scope = "job"
org_name = "platform"
app_slug = "payments"
job_slug = "web"
key = "db_password"
sensitive = true
value_wo = var.db_password
}Data Sources
The provider also supports data sources for looking up existing resources.
These are useful when:
- some resources are already managed outside Terraform;
- you are incrementally adopting the provider; or
- you need to reference an existing resource created elsewhere.
Examples include lookups for:
- organizations;
- applications;
- jobs;
- environments;
- groups;
- roles;
- Nomad clusters; and
- service accounts.
Ephemeral Resources
Ephemeral resources return a value without storing it in Terraform state:
nomatron_agent_tokenrotates and returns a fresh network agent token.nomatron_service_account_tokenmints and returns a fresh service account token.
Use them when you need to hand a secret to another system (for example, a secret manager) without writing it into your state file.
Actions And Operational Workflows
The provider also supports selected imperative actions:
nomatron_import_nomad_jobnomatron_speculative_plannomatron_destroy_jobnomatron_destroy_app_jobs
Resources describe durable state. Actions trigger operational behavior.
nomatron_destroy_job and nomatron_destroy_app_jobs create destroy plans that stop and purge the live Nomad job (or every live job in an app). They do not delete the Nomatron application or job resources. With apply = true, the destroy apply is queued once the plan is ready; plans that need approval must still be approved in Nomatron first.
Speculative plans can target an app environment. Use the provider version that exposes environment_slug when you need to review a plan for a non-default environment.
A Note On Role Assignments
nomatron_role_assignment is supported, but there is a current limitation in the provider and API surface: full remote read/list support is not yet available in the same way as some other resources.
That means Terraform can still manage role assignments, but drift detection is more limited than for fully readable resources.
A Good Starting Set
If you are just adopting the provider, a strong first set is:
- organizations;
- groups and members;
- roles and assignments;
- Nomad clusters;
- applications;
- jobs;
- environments; and
- variables.
That gives you a complete declarative onboarding story without trying to push every operational concern into Terraform on day one.