Bundle YAML Specification
massdriver.yaml defines a bundle. mass bundle lint, build, and publish validate it against the bundle metaschema.
Complete Specification​
yaml
# =============================================================================
# BUNDLE METADATA
# =============================================================================
# name (required)
# Bundle name, unique in your organization. It is also the name of the
# bundle's repository.
# - Pattern: ^[a-z][a-z0-9-_]+[a-z0-9_]$
# - Length: 3-100 characters
name: my-bundle-name
# description (required)
# Shown in the catalog. Length: 1-1024 characters.
description: |
A managed PostgreSQL database with automated backups,
high availability, and encryption at rest.
# version (recommended)
# Semantic version, MAJOR.MINOR.PATCH. Must match ^\d+\.\d+\.\d+$.
# If omitted, the CLI warns and publishes 0.0.0, which can be republished
# and disables versioning.
version: 1.2.3
# source_url (optional)
# Link to the bundle's source repository.
source_url: https://github.com/my-org/my-bundle
# provides (optional)
# [runtime] marks the bundle as a runtime that applications run on.
# See /bundle-development/runtimes-and-applications
# provides: [runtime]
# =============================================================================
# PROVISIONING STEPS
# =============================================================================
# steps (optional, recommended)
# The IaC modules a deployment runs. Steps run in order on plan and
# provision, and in reverse order on decommission.
# If omitted, the CLI warns and uses a single terraform step at path "src".
steps:
- # path (required)
# A single subdirectory of the bundle: not nested, not ".".
# Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_-]*$
path: src
# provisioner (required)
# - opentofu, terraform, helm, bicep
# - <provisioner>:<tag> pins an image tag, such as opentofu:1.10.
# Without a tag, the step runs the "latest" image.
# Self-hosted installations can run custom provisioner images.
# See /platform-operations/self-hosted/custom-provisioners
provisioner: opentofu
# skip_on_delete (optional, default: false)
# Skip this step on decommission, so its cloud resources stay.
skip_on_delete: false
# config (optional)
# Provisioner settings. Each provisioner page lists its keys.
# - A string is a jq expression, evaluated against .params
# (including .params.md_metadata) and .dependencies.
# Use '@text "value"' for a literal string.
# - A boolean or number is used as is.
# - A map is evaluated key by key.
# An expression that fails or returns null fails the deployment.
# .connections is a deprecated alias for .dependencies.
config:
checkov:
halt_on_failure: '.params.md_metadata.default_tags["md-environment"] == "prod"'
# resources (optional)
# jq templates that render this step's resources after it applies,
# keyed by a name declared in the top-level `resources`.
# A template reads .params, .connections, .envs, .secrets, and .outputs
# (the step's IaC outputs) and must return one JSON object.
# Provisioners also read resource_<name>.jq files from the step
# directory. An inline template takes priority over a file.
resources:
database:
template: |
{
authentication: {
hostname: .outputs.hostname,
port: .outputs.port,
username: .outputs.username,
password: .outputs.password
}
}
- path: chart
provisioner: helm
skip_on_delete: true
config:
namespace: .params.namespace
release_name: .params.release_name
- path: bicep
provisioner: bicep
config:
location: .dependencies.azure_credentials.region
resource_group: '@text "my-resource-group"'
delete_resource_group: true
# =============================================================================
# PARAMETERS
# =============================================================================
# params (required)
# JSON Schema (draft-07) for the instance's configuration form, plus
# Massdriver annotations ($md.*). Params become IaC inputs.
# Schema patterns: /bundle-development/schema-design/validation-patterns
# Massdriver annotations: /bundle-development/schema-design/massdriver-annotations
params:
# examples (optional)
# Presets the form offers. __name is the preset's label.
examples:
- __name: Development
instance_type: small
storage_gb: 20
high_availability: false
- __name: Production
instance_type: large
storage_gb: 500
high_availability: true
required:
- database_name
- instance_type
# properties (required)
properties:
database_name:
type: string
title: Database Name
description: Name for the database instance
pattern: "^[a-z][a-z0-9-]{2,30}$"
# message: custom error message per keyword
message:
pattern: Must be 3-31 chars, lowercase alphanumeric with hyphens
# Read-only after the instance is provisioned
$md.immutable: true
instance_type:
type: string
title: Instance Type
enum:
- small
- medium
- large
- xlarge
default: medium
storage_gb:
type: integer
title: Storage (GB)
minimum: 20
maximum: 16384
default: 100
high_availability:
type: boolean
title: High Availability
default: false
backup:
type: object
title: Backup Configuration
required:
- retention_days
properties:
retention_days:
type: integer
title: Retention Days
minimum: 1
maximum: 365
default: 7
window:
type: string
title: Backup Window
description: Preferred backup window (UTC)
pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]-([01]?[0-9]|2[0-3]):[0-5][0-9]$"
default: "03:00-04:00"
allowed_cidrs:
type: array
title: Allowed CIDRs
items:
type: string
pattern: "^([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}$"
default: []
# dependencies (optional)
# The JSON Schema `dependencies` keyword: show fields based on other
# fields. Not the bundle's top-level `dependencies` block.
dependencies:
high_availability:
oneOf:
- properties:
high_availability:
const: true
replica_count:
type: integer
title: Read Replicas
minimum: 1
maximum: 5
default: 1
- properties:
high_availability:
const: false
# =============================================================================
# DEPENDENCIES (inputs)
# =============================================================================
# dependencies (optional)
# The resources this bundle consumes, keyed by name. Names match
# ^[a-zA-Z0-9][a-zA-Z0-9_-]*$. Each becomes an IaC input of that name,
# and jq expressions read it as .dependencies.<name>.
# Replaces the deprecated `connections` block.
dependencies:
vpc:
# resource_type (required)
# A resource type and the versions accepted:
# - aws-vpc latest stable version
# - aws-vpc@1.2.3 exact version
# - aws-vpc@~1 newest 1.x
# - aws-vpc@~1.2 newest 1.2.x
# - aws-vpc@latest newest stable version
# - aws-vpc@~1+dev newest 1.x, development releases included
# See /bundle-development/dependencies-resources/version-resolution
resource_type: aws-vpc@~1
# required (required)
# true: the dependency must be filled before the bundle can deploy.
required: true
credentials:
resource_type: aws-iam-role@~1
required: true
monitoring:
resource_type: datadog-agent@~2
required: false
# cardinality (optional, default: one)
# - one: exactly one resource
# - many: any number of resources of the type. The IaC receives a map
# from resource ID to resource. A required `many` dependency
# needs at least one.
subnets:
resource_type: aws-subnet@~1
required: false
cardinality: many
# =============================================================================
# RESOURCES (outputs)
# =============================================================================
# resources (optional)
# The resources this bundle produces for other bundles to depend on.
# Replaces the deprecated `artifacts` block.
resources:
database:
# resource_type (required)
# Takes the same version forms as a dependency. The newest published
# version in range types the resource.
resource_type: postgresql-authentication@~1
# required (required)
# true: the bundle always creates this resource.
required: true
read_replica:
resource_type: postgresql-authentication@~1
required: false
# =============================================================================
# UI SCHEMA
# =============================================================================
# ui (required, may be empty: `ui: {}`)
# RJSF uiSchema for the params form.
# See /bundle-development/schema-design/ui-schema
ui:
ui:order:
- database_name
- instance_type
- storage_gb
- backup
- high_availability
- "*"
database_name:
ui:help: Choose a unique name. Cannot be changed after creation.
storage_gb:
ui:widget: updown
allowed_cidrs:
items:
ui:placeholder: "10.0.0.0/8"
# =============================================================================
# APPLICATION CONFIGURATION
# =============================================================================
# app (optional)
# Environment variables and secrets for the workload. A deployment writes
# them to envs.json and secrets.json for the provisioner.
# The terraform-massdriver-application module reads this block:
# https://github.com/massdriver-cloud/terraform-massdriver-application
app:
# runtime (applications only)
# The runtime the application runs on, as <runtime>@<constraint>.
# mass writes app.runtime_constraint when it publishes. Do not set it.
# See /bundle-development/runtimes-and-applications
# runtime: lambda@~1.2
# envs (optional)
# Variable name to jq expression. Names match ^[a-zA-Z_][a-zA-Z0-9_]*$.
# Expressions read .params and .dependencies. Each result is converted
# to a string. An expression that fails or returns null fails the
# deployment.
envs:
DATABASE_HOST: .dependencies.database.authentication.hostname
DATABASE_PORT: .dependencies.database.authentication.port
LOG_LEVEL: .params.log_level
DATABASE_URL: >-
"postgresql://" + .dependencies.database.authentication.username +
"@" + .dependencies.database.authentication.hostname +
":" + (.dependencies.database.authentication.port | tostring) +
"/" + .dependencies.database.authentication.database
APP_NAME: '@text "my-application"'
# secrets (optional)
# Secrets set on the instance in the UI, CLI, or API.
# Names match ^[A-Za-z_][A-Za-z0-9_]*$.
secrets:
DATABASE_PASSWORD:
required: true # default: false
title: Database Password
description: Password for database authentication
SERVICE_ACCOUNT_JSON:
required: true
json: true # default: false. The value is parsed as JSON.
title: Service Account Credentials
Minimal Example​
yaml
name: simple-bucket
description: A simple S3 bucket for file storage
version: 1.0.0
steps:
- path: src
provisioner: opentofu
params:
required:
- bucket_name
properties:
bucket_name:
type: string
title: Bucket Name
pattern: "^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$"
dependencies:
aws_credentials:
resource_type: aws-iam-role@~1
required: true
resources:
bucket:
resource_type: aws-s3-bucket@~1
required: true
ui: {}
Infrastructure Bundle Example​
yaml
name: aws-rds-postgres
description: Managed PostgreSQL on AWS RDS with automated backups and encryption
version: 2.1.0
source_url: https://github.com/my-org/aws-rds-postgres
steps:
- path: src
provisioner: opentofu
config:
checkov:
halt_on_failure: '.params.md_metadata.default_tags["md-environment"] == "prod"'
params:
examples:
- __name: Development
instance_class: db.t3.micro
storage_gb: 20
multi_az: false
- __name: Production
instance_class: db.r6g.large
storage_gb: 500
multi_az: true
required:
- database_name
- instance_class
properties:
database_name:
type: string
title: Database Name
pattern: "^[a-z][a-z0-9_]{2,62}$"
$md.immutable: true
instance_class:
type: string
title: Instance Class
enum:
- db.t3.micro
- db.t3.small
- db.r6g.large
- db.r6g.xlarge
storage_gb:
type: integer
title: Storage (GB)
minimum: 20
maximum: 16384
default: 100
multi_az:
type: boolean
title: Multi-AZ
default: false
dependencies:
vpc:
resource_type: aws-vpc@~1
required: true
aws_authentication:
resource_type: aws-iam-role@~1
required: true
resources:
database:
resource_type: postgresql-authentication@~1
required: true
ui:
ui:order:
- database_name
- instance_class
- storage_gb
- multi_az
- "*"
Application Bundle Example​
A containerized API deployed with Helm. To ship many services on the same infrastructure without copying IaC, use a runtime instead.
yaml
name: containerized-api
description: Deploy a containerized API to Kubernetes
version: 1.0.0
steps:
- path: chart
provisioner: helm
config:
namespace: .params.namespace
release_name: .params.release_name
params:
required:
- image
- namespace
- release_name
properties:
image:
type: object
title: Container Image
required:
- repository
- tag
properties:
repository:
type: string
title: Repository
tag:
type: string
title: Tag
default: latest
namespace:
type: string
title: Namespace
default: default
release_name:
type: string
title: Release Name
replicas:
type: integer
title: Replicas
minimum: 1
maximum: 10
default: 2
port:
type: integer
title: Container Port
default: 8080
dependencies:
kubernetes_cluster:
resource_type: kubernetes-cluster@~1
required: true
database:
resource_type: postgresql-authentication@~1
required: true
resources:
service:
resource_type: kubernetes-service@~1
required: false
app:
envs:
DATABASE_HOST: .dependencies.database.authentication.hostname
DATABASE_PORT: .dependencies.database.authentication.port
DATABASE_NAME: .dependencies.database.authentication.database
DATABASE_USER: .dependencies.database.authentication.username
PORT: .params.port
secrets:
DATABASE_PASSWORD:
required: true
title: Database Password
API_SECRET_KEY:
required: true
title: API Secret Key
ui:
ui:order:
- image
- namespace
- replicas
- port
- "*"
Legacy Format: connections and artifacts​
Older bundles declare inputs and outputs as JSON Schema blocks named connections and artifacts:
yaml
connections:
required:
- vpc
properties:
vpc:
$ref: aws-vpc
artifacts:
required:
- database
properties:
database:
$ref: postgresql-authentication
This format is deprecated:
- The CLI prints a deprecation warning for
connectionsandartifacts. - It has no version ranges. See Version Resolution: The legacy format.
- Setting both
connectionsanddependencies, or bothartifactsandresources, is an error. - A runtime must not use it. See Runtimes and Applications: Requirements.
To migrate, turn each properties entry into a named entry with a resource_type and a version range, and replace the required list with required: true or required: false on each entry.
Field Reference​
Top-level Fields​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | Bundle name. 3-100 characters, ^[a-z][a-z0-9-_]+[a-z0-9_]$. | |
description | string | Yes | 1-1024 characters. | |
params | object | Yes | JSON Schema for the params form. Must have properties. | |
ui | object | Yes | RJSF uiSchema. May be {}. | |
version | string | No | 0.0.0 | MAJOR.MINOR.PATCH. |
source_url | string | No | Link to the source repository. | |
steps | array | No | One terraform step at src | Provisioning steps. |
dependencies | object | No | Resources the bundle consumes. Replaces connections. | |
resources | object | No | Resources the bundle produces. Replaces artifacts. | |
app | object | No | envs, secrets, and, for an application, runtime. | |
provides | array | No | [runtime] marks the bundle as a runtime. |
access and type are deprecated and have no effect. The CLI warns when they are set.
Dependencies​
| Field | Type | Required | Description |
|---|---|---|---|
resource_type | string | Yes | name or name@<version or range>. See Version Resolution. |
required | boolean | Yes | The dependency must be filled before the bundle can deploy. |
cardinality | string | No | one (default) or many. With many, the IaC receives a map from resource ID to resource. |
Resources​
| Field | Type | Required | Description |
|---|---|---|---|
resource_type | string | Yes | name or name@<version or range>. The newest published version in range types the resource. |
required | boolean | Yes | The bundle always creates this resource. |
Steps​
| Field | Type | Required | Description |
|---|---|---|---|
path | string | Yes | A subdirectory of the bundle, ^[a-zA-Z0-9][a-zA-Z0-9_-]*$. |
provisioner | string | Yes | opentofu, terraform, helm, or bicep, optionally with :<tag>. |
skip_on_delete | boolean | No | Skip the step on decommission. |
config | object | No | Provisioner settings. Strings are jq expressions. |
resources | object | No | <resource name>: {template: <jq>}. Renders a resource from the step's outputs. |
App​
| Field | Type | Description |
|---|---|---|
envs | object | Environment variable name to jq expression. |
secrets | object | Secret name to required, json, title, and description. |
runtime | string | The runtime an application runs on, <runtime>@<constraint>. |