Identifier Constraints Reference
Validation rules for the identifier of every addressable object in Massdriver. Identifiers are immutable once created.
Summary​
| Object | Identifier | Pattern | Length | Unique within | Example |
|---|---|---|---|---|---|
| Organization | id | a-z, 0-9, - | 2–20 | Massdriver | acme-corp |
| Project | id | a-z, 0-9 | 1–20 | Organization | ecomm |
| Environment | id | {project}-{environment}; segment a-z, 0-9 | segment 1–20 | Project | ecomm-prod |
| Component | id | {project}-{component}; segment a-z, 0-9 | segment 1–20 | Project | ecomm-db |
| Instance | id | {project}-{environment}-{component} | up to 62 | Organization | ecomm-prod-db |
| Repository (OCI repo) | id | a-z, 0-9, -, _ | 1–100 | Organization | aws-aurora-postgres |
Bundle name in massdriver.yaml | name | ^[a-z][a-z0-9-]+[a-z0-9]$ | 3–53 | Organization | aws-aurora-postgres |
| Resource type | $md.name | ^[a-z0-9-]{3,100}$ | 3–100 | Organization | aws-iam-role |
| Resource (provisioned) | id | {instance}.{field} | computed | Organization | ecomm-prod-db.database |
| Resource (imported) | id | UUID | 36 | Organization | 123e4567-e89b-12d3-a456-426614174000 |
Organization​
- Pattern: lowercase letters, digits, and hyphens (
^[a-z0-9-]{1,20}$) - Length: 2–20 characters
- Uniqueness: across all of Massdriver
- Reserved:
aws,amazon,gcp,google,hashicorp,azure,azurerm,microsoft,kubernetes,helm,admin,administrator,root,massdriver-cloud,massdriver-inc
Valid: acmecorp, acme-corp, myorg123. Invalid: AcmeCorp (uppercase), my_org (underscore), aws (reserved).
Project​
- Pattern: lowercase letters and digits only (
^[a-z0-9]{1,20}$) - Length: 1–20 characters
- Uniqueness: within the organization
The project id is the first segment of every environment, component, and instance id in the project.
Valid: ecomm, webapp, 1data. Invalid: web-app (hyphen), WebApp (uppercase).
Environment​
- Pattern: lowercase letters and digits only (
^[a-z0-9]{1,20}$) - Length: 1–20 characters
- Uniqueness: within the project
You choose the local segment (prod). The API id is {project}-{environment} (ecomm-prod). The environment segment is the second segment of every instance id in the environment.
Valid: prod, staging, dev1. Invalid: prod-env (hyphen), Prod (uppercase).
Component​
- Pattern: lowercase letters and digits only (
^[a-z0-9]{1,20}$) - Length: 1–20 characters
- Uniqueness: within the project
A component is a bundle placed in a project's blueprint for one purpose. The same Redis bundle added twice, as cache and sessions, is two components. You choose the local segment (db). The API id is {project}-{component} (ecomm-db). The component segment is the last segment of every instance id for that component.
Valid: redis, database, apiserver. Invalid: redis-cluster (hyphen), Redis (uppercase).
Instance​
An instance is a component deployed in one environment. Its id is built from its parents and cannot be set:
{project}-{environment}-{component} → ecomm-prod-db
The maximum length is 62 characters (three 20-character segments and two hyphens). Each environment has exactly one instance per component.
Name prefix​
Each instance also has a name prefix: md_metadata.name_prefix in a deployment, name in the v2 API. Use it to name cloud resources in your IaC.
The organization's naming convention renders the name prefix. The default convention, {{instance.id}}-{{component.suffix}}, produces ecomm-prod-db-x7k2. The suffix is 4 random characters generated once per component, so every instance of a component shares it. The name prefix is set when the instance is created and does not change afterward, even if the naming convention changes.
Repository​
Bundles and resource types are published to OCI repositories in your organization. The repository name is the repository's id. A release is addressed by a version tag (aws-aurora-postgres:1.2.3), and the full OCI path is {organization}/{repository}.
- Pattern: lowercase letters, digits, hyphens, and underscores (
^[a-z0-9-_]+$) - Length: 1–100 characters
- Uniqueness: within the organization, across bundle and resource type repositories
Bundle name​
mass bundle publish publishes a bundle to the repository named by name in massdriver.yaml. The bundle schema is stricter than the repository rule:
- Pattern:
^[a-z][a-z0-9-]+[a-z0-9]$: starts with a letter, ends with a letter or digit, no underscores - Length: 3–53 characters
Valid: aws-aurora-postgres, redis-cluster. Invalid: Aws-Aurora (uppercase), redis- (ends with a hyphen), 1redis (starts with a digit), re (too short), redis_cluster (underscore).
Resource type​
A resource type is identified by $md.name in its schema.
- Pattern:
^[a-z0-9-]{3,100}$ - Length: 3–100 characters
- Uniqueness: within the organization. A resource type cannot share a name with a bundle repository in the same organization.
The API id of a published version is {name}@{version} (aws-iam-role@1.2.3). Bundles reference a resource type by name and an optional version constraint (resource_type: aws-iam-role@~1). A reference written as {organization}/{name} resolves to {name}.
Valid: vpc-network, custom-database, docker-registry. Invalid: VPC (uppercase), vp (too short), vpc_network (underscore).
Resource​
A resource's id depends on how it was created:
| Origin | Format | Example |
|---|---|---|
| Provisioned by a deployment | {instance id}.{field} | ecomm-prod-db.database |
| Imported | UUID | 123e4567-e89b-12d3-a456-426614174000 |
field is the key under resources in the bundle's massdriver.yaml that produced the resource.
Deployment metadata​
Every deployment receives an md_metadata object. Several keys use the old nouns (target, package) because bundles in the field read them.
{
"name_prefix": "ecomm-prod-db-x7k2",
"default_tags": {
"managed-by": "massdriver",
"md-project": "ecomm",
"md-environment": "prod",
"md-component": "db",
"md-instance": "ecomm-prod-db"
},
"observability": {
"alarm_webhook_url": "https://api.massdriver.cloud/alarms/<environment-uuid>/<alarm-token>"
},
"target": {
"contact_email": "admin@example.com"
},
"package": {
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:45:00Z",
"deployment_enqueued_at": "2024-01-20T15:00:00Z",
"previous_status": "provisioned"
}
}
| Key | Contents |
|---|---|
name_prefix | The instance's name prefix |
default_tags | Tags to apply to cloud resources. The keys depend on the organization's default tags setting. The example shows defaultTags set to md-project, md-environment, md-component, md-instance. An organization that has never set defaultTags sends managed-by, md-project, md-target, md-manifest, and md-package. |
observability.alarm_webhook_url | Webhook URL for the environment's alarms |
target.contact_email | Email of the account that started the deployment. Service accounts get {id}@serviceaccounts.massdriver.internal. |
package | Instance timestamps and the instance status before this deployment |
See Using Bundle Deployment Metadata for examples.