Admiral

Concepts

Variables & Outputs

Variables set a component's config per environment, and outputs record what a component produced after it applies.

A component's inputs are what its Terraform module or Helm chart accepts: a module's variables, a chart's values. A component's values set those inputs, and they come from two places. Variables configure a component differently per environment, and outputs record what a component produced.

Where do a component's values come from?

  • Variables are configuration you set. They are referenced in templates as .var.
  • Outputs are values captured from a component after it deploys. Reading them from another component's values, as .component.NAME.OUTPUT, is planned and not available yet.

They come from opposite ends: variables are inputs you provide, outputs are facts a deployment produces.

How do I configure a component per environment?

A variable is config scoped to an environment. The same component deployed to dev and prod renders against each environment's own variables, so one definition produces environment-appropriate results.

.var.region        →  "us-east-1"   (prod)   /   "us-west-2"  (dev)
.var.instance_size →  "large"       (prod)   /   "small"      (dev)

Variable overrides can also ride inside a changeset, so a value change is staged and reviewed alongside the component changes it affects.

How does one component pass data to another?

When a component applies successfully, it can emit outputs, such as a database endpoint or a VPC ID. Admiral records those outputs on the environment.

Passing those outputs to another component is planned and not available yet. Today Admiral refuses values that reference another component's output. The rest of this section describes the planned design.

This will make the dependency graph more than ordering. A downstream component will not just wait for its upstream; it will read the upstream's outputs:

Because outputs only exist after the upstream applies, a run will defer any component that references an upstream output until that upstream has actually deployed. Then it will render the downstream against the concrete value and apply it. (See the wavefront.)

What can a values template reference?

When you plan, each component's values template renders against these namespaces:

NamespaceHolds
.varenvironment variables you set
.componentoutputs captured from other components (planned, not available yet)
.selfthe component's own identity and metadata
.appapplication-level context

The result is the fully resolved set of values. It is immutable, and the component records its digest beside the revision it runs. That record, not the live template, is exactly what deployed.

A component renders when you plan. Once output references are available, a component that reads outputs will render again after its upstream applies, against the values that exist at that moment. That is why output-dependent components will wait, since rendering them earlier would template against data that does not exist yet.

How does it fit together?

Variables let one definition serve many environments. Output references, once available, will let many components compose into one system. Together they are why an environment can be described once and deployed correctly everywhere.

Where to go next

On this page