Resources & Resource Types
A resource is structured data that a bundle produces to describe what it provisioned. A resource type is the JSON Schema contract a resource must match. One bundle's resource fills another bundle's dependency through that contract.
Resource types were previously called artifact definitions, and resources artifacts. The old names still appear in some API fields, CLI aliases, and the
massdriver_artifactTerraform resource.
How resources work​
A PostgreSQL bundle produces a resource with the database's connection details. An application bundle that depends on that resource type receives the hostname, port, and credentials at deploy time, validated against the resource type's schema.
Example PostgreSQL Resource:
{
"authentication": {
"hostname": "db.example.com",
"port": 5432,
"username": "app_user",
"password": "secret_value"
},
"infrastructure": {
"arn": "arn:aws:rds:us-west-2:123456789012:db:mydb",
"region": "us-west-2"
}
}
Resource Types​
A resource type:
- Defines the schema of a resource's data
- Allows links only between components that produce and consume the same type
- Passes state between tools, for example from an OpenTofu bundle to a Helm bundle
- Masks fields marked
$md.sensitive
Example Resource Type:
{
"type": "object",
"title": "PostgreSQL Database",
"properties": {
"authentication": {
"type": "object",
"properties": {
"hostname": { "type": "string" },
"port": { "type": "integer" },
"password": {
"type": "string",
"$md.sensitive": true
}
}
}
}
}
Resource origins​
Provisioned resources​
A deployed bundle produces them:
- Belong to the instance that produced them
- ID is
<instance ID>.<field>, for exampleecomm-prod-db.authentication - Updated on each deployment of the instance
- Removed with the instance
Imported resources​
You create them for things Massdriver does not provision, such as cloud credentials (AWS IAM roles, GCP service accounts) and existing infrastructure. Use Import Resource on the Resources page, or mass resource create. See Import a Resource.
- ID is a UUID
- Lifecycle is independent of any instance
How a resource reaches a bundle​
- Link: drawing a link between two components checks that both ends use the same resource type.
- Validation: a produced resource is validated against the resource type's schema.
- Injection: at deploy time, the resource's data is passed to the consuming bundle as the dependency's value.
A dependency can also be filled by an environment default or a remote reference. See Dependencies & Links.
Resource types are versioned​
A resource type is authored as a massdriver.yaml, published to its own OCI repository in your organization's catalog, and versioned like a bundle:
- Each version is a semantic version. Dependencies can reference a release channel such as
~1orlatest. - Published versions are immutable, except
0.0.0, which can be republished. - Resource type repositories are not grant-gated. Anyone with
repo:viewandrepo:pullcan use them.
mass resource-type create aws-vpc
mass resource-type publish ./aws-vpc
mass resource-type pull aws-vpc@2.1.0
mass resource-type get aws-vpc
The version is the version of the contract between bundles. Adding a required field to a payload that three bundles consume breaks all three, so it needs a major version bump.
Usage in massdriver.yaml​
A bundle names the resource types it consumes under dependencies and the ones it produces under resources, each with the versions it accepts:
# What the bundle consumes
dependencies:
vpc:
resource_type: aws-vpc@~1
required: true
# What the bundle produces
resources:
database:
resource_type: postgresql-authentication@1.0.0
required: true
A dependency accepts a range, which Massdriver resolves at deploy time. A name without @ means latest. A resource names the version it produces. See Version Resolution.
connectionsandartifactsare the previous names for these blocks. They still work, andmass bundle publishwarns about them. A slot declared that way carries no version range and takes part in no version checks.
Best Practices​
- Mark sensitive fields with
$md.sensitivefor automatic masking - Group related properties logically (authentication, infrastructure, iam)
- Use descriptive field names that indicate what the resource represents
- Design resource types for reuse across multiple bundles
Related Documentation​
- Bundle YAML Specification - Connection and resource configuration
- Resource Type Specification - Complete schema reference
- Version Resolution - How a version range picks a resource at deploy time
- Official Resource Types - The resource types Massdriver publishes (repository)
- Massdriver Annotations -
$md.sensitiveand other extensions