Provisioner Specification
A provisioner is a container image that runs one step of a bundle for a plan, provision, or decommission deployment. Massdriver has four official provisioners:
Self-hosted installations can also run custom provisioners.
Configuration​
The steps block in massdriver.yaml lists the steps a deployment runs and the provisioner for each.
path(required): the step's directory in the bundle.provisioner(required):opentofu,terraform,helm, orbicep. Add:<tag>to pin an image tag, such asopentofu:1.10. Without a tag, the step runs thelatestimage,massdrivercloud/provisioner-<name>:latest.skip_on_delete:trueskips the step on decommission, so its cloud resources stay, such as encryption keys.config: provisioner settings. Each provisioner page lists its keys. A string is a jq expression evaluated against the jq context. Booleans and numbers are used as is, and maps are evaluated key by key. An expression that fails or returnsnullfails the deployment.resources: jq templates that render the step's resources. See Resources.
Steps run in order on plan and provision, and in reverse order on decommission.
Example​
steps:
- path: src
provisioner: opentofu
- path: chart
provisioner: helm
skip_on_delete: true
config:
namespace: .params.namespace
release_name: .params.release_name
- path: another
provisioner: bicep
skip_on_delete: true
config:
location: .dependencies.azure_credentials.region
resource_group: '@text "foo"'
delete_resource_group: true
The jq context​
config expressions and app.envs expressions run against this object:
| Key | Holds |
|---|---|
.params | The instance's params, plus md_metadata |
.dependencies | The resources that fill the bundle's dependencies, keyed by dependency name |
.connections is a deprecated alias for .dependencies. It holds the same data.
config:
region: .dependencies.azure_credentials.region
The bundle's own resources do not exist yet when these expressions run, so they cannot be read.
md_metadata holds name_prefix, default_tags, and observability.alarm_webhook_url, among others. default_tags always includes managed-by and md-instance. Its other keys come from the organization's default tags setting.
Environment​
Each step runs in its own container. The bundle is at /massdriver/bundle, and the step runs in /massdriver/bundle/<path>.
Inputs​
| File | Holds |
|---|---|
/massdriver/params.json | The instance's params, plus md_metadata |
/massdriver/dependencies.json | The resources that fill the bundle's dependencies |
/massdriver/connections.json | Deprecated. The same document as dependencies.json |
/massdriver/envs.json | The resolved app.envs |
/massdriver/secrets.json | The instance's secrets, decrypted |
/massdriver/config.json | The step's config, with its jq expressions evaluated |
/massdriver/oidc/<level>.jwt | Deployment identity tokens, when enabled |
Both dependencies.json and connections.json are written for every step, so a custom provisioner can move to the new name when it is ready. The official provisioners still read connections.json.
Environment Variables​
| Variable | Description |
|---|---|
MASSDRIVER_BUNDLE_NAME | Name of the bundle. |
MASSDRIVER_BUNDLE_VERSION | Version of the bundle. |
MASSDRIVER_DEPLOYMENT_ACTION | plan, provision, or decommission. |
MASSDRIVER_DEPLOYMENT_ID | ID of the deployment. |
MASSDRIVER_INSTANCE_ID | Identifier of the instance, such as api-prod-db. |
MASSDRIVER_ORGANIZATION_ID | Identifier of the organization. |
MASSDRIVER_ORGANIZATION_UUID | UUID of the organization. |
MASSDRIVER_STEP_PATH | path of the current step. |
MASSDRIVER_TOKEN | The deployment's token for the Massdriver API. |
MASSDRIVER_URL | Base URL of the Massdriver API. |
MASSDRIVER_OIDC_<LEVEL>_TOKEN_FILE | Path of each deployment identity token, when enabled. |
TRACEPARENT | W3C trace context of the deployment. |
MASSDRIVER_BUNDLE_ID | Deprecated. ID of the bundle release. |
MASSDRIVER_MANIFEST_ID | Deprecated. ID of the component. |
MASSDRIVER_PACKAGE_ID | Deprecated. ID of the instance. |
MASSDRIVER_PACKAGE_NAME | Deprecated. Name prefix of the instance, such as ecomm-prod-api-0000. |
MASSDRIVER_TARGET_MODE | Deprecated. Mode of the environment. |
Resources​
After a provision, the official provisioners publish the step's resources with jq templates. Each template renders one resource named in the bundle's resources block. Templates come from, in priority order:
steps[].resources.<name>.templateinmassdriver.yamlresource_<name>.jqin the step directoryartifact_<name>.jqin the step directory (legacy)
A template reads this object and must return exactly one JSON object:
{
"params": {},
"connections": {},
"envs": {},
"secrets": {},
"outputs": {}
}
outputs is what the step produced: the module outputs for OpenTofu and Terraform, the deployment outputs for Bicep, and an array of rendered manifests for Helm. A template for a name that is not declared in resources fails the deployment. The provisioner also deletes any resource of the instance whose name is no longer declared.
On decommission, the provisioner deletes the resources that the step has templates for.
OpenTofu and Terraform steps can also publish resources with the massdriver_resource resource of the Massdriver provider.