Data & Event Flow
Data enters Massdriver through the UI, the mass CLI, the GraphQL API, the Terraform provider, cloud alarm webhooks, and running deployments. Massdriver records each change as one event in your organization's audit log. Data leaves through event destinations, GraphQL subscriptions, API and CLI reads, resource exports, and the dependencies of later deployments.
In​
| Input | Interfaces | Events |
|---|---|---|
| Instance configuration and deployments | UI, mass instance deploy, mass environment deploy, createDeployment, proposeDeployment, GitHub Action | deployment.*, instance.updated |
| Imported resources | UI Import Resource, mass resource create, createResource, massdriver_imported_resource | resource.imported, resource.updated, resource.deleted |
| Provisioned resources | A deployment: jq resource templates or massdriver_resource | resource.provisioned, resource.deleted |
| Stash entries | mass alpha stash set, alphaSetStashEntry, massdriver_stash_entry, a deployment | stash_entry.set, stash_entry.deleted |
| Instance secrets | setInstanceSecret, removeInstanceSecret | secret.set, secret.unset |
| Alarms and alarm states | massdriver_instance_alarm, createInstanceAlarm, the environment's alarm webhook URL | alarm.*, alarm_state.created |
| Dependency wiring | mass component link, mass environment default, mass instance remote-reference set, mass resource grant create, the API | link.*, connection.*, environment_default.*, remote_reference.* |
| Bundles and resource types | mass bundle publish, mass resource-type publish | repo.published, resource_type.published |
Deployments​
A person, CI job, or service account creates a deployment of an instance: a direct deployment, a proposal, a plan, or a rollback. The deployment snapshots the instance's params, the resources that fill its dependencies, and the bundle version. Refer to Deployments.
After a deployment is created, Massdriver and the provisioner set its status. Each change of status records an event:
| Event | When |
|---|---|
deployment.created | Any deployment is created, including a proposal and a rollback. |
deployment.proposed | A deployment is proposed for approval. A rollback is always proposed. |
deployment.approved, deployment.rejected | A reviewer decides on a proposal. |
deployment.enqueued | The deployment reaches the front of its instance's queue and goes to a runner. |
deployment.started | The provisioner reports RUNNING. |
deployment.completed, deployment.failed | The provisioner reports the result. |
deployment.aborted | A person or service account aborts the deployment. |
The provisioner also streams the deployment's logs, which mass deployment logs and the deploymentLogs subscription read.
Imported resources​
An imported resource records infrastructure that Massdriver did not provision, such as an existing VPC or a cloud credential. Its payload must match the schema of its resource type. Create one in the UI, with mass resource create, with createResource, or with the Terraform provider's massdriver_imported_resource. Refer to Import a Resource.
An imported resource has a UUID and no instance. You can change it with mass resource update or updateResource, which records resource.updated. You cannot delete it while a connection uses it.
Provisioned resources​
After a provision step, the provisioner renders each resource that the bundle declares under resources and sends it to Massdriver with the deployment's token. OpenTofu and Terraform steps can also send resources with the provider's massdriver_resource. Massdriver validates each resource against its resource type and records resource.provisioned. A later deployment that sends the same resource replaces it and records resource.provisioned again. Refer to Provisioners: Resources.
A provisioned resource belongs to its instance. Its ID is <instance ID>.<field>, such as ecomm-prod-db.authentication. Only a deployment of that instance can change it. A decommission deletes it.
Stash​
The stash holds key and value entries on a project, environment, component, instance, or deployment. People, CI jobs, automations, and deployment steps write to it with mass alpha stash set, the GraphQL API, or the Terraform provider's massdriver_stash_entry. Massdriver stores each value as written and does not act on it.
Each set and delete records stash_entry.set or stash_entry.deleted. A sensitive value is never in an event. An entry that expires records no event.
Alarms​
A bundle registers an instance alarm with massdriver_instance_alarm. The cloud's monitoring service sends state changes to the environment's alarm webhook URL, and each change records alarm_state.created. Refer to Monitoring & Alarms.
Dependency wiring​
These inputs decide which resource fills a dependency of an instance:
| Input | Interfaces | Events |
|---|---|---|
| A link on the project blueprint | UI, mass component link | link.created and link.deleted, then connection.created and connection.deleted for each instance that the link fills |
| An environment default | UI, mass environment default, setEnvironmentDefault | environment_default.created, environment_default.deleted |
| A remote reference on an instance | UI, mass instance remote-reference set, setRemoteReference | remote_reference.assigned, remote_reference.unset |
| A grant of a resource to other environments | mass resource grant create, createResourceGrant | None |
The order in which they fill a slot is in What fills a slot. Grants are in Share Resources.
Out​
| Output | Interfaces | Delivery |
|---|---|---|
| Event destinations | HTTP, Slack, ServiceNow, PagerDuty | Pushed. Retried, at least once, kept for redelivery. |
| GraphQL subscriptions | WebSocket | Pushed while connected. |
| API and CLI reads | GraphQL queries, mass ... get and list | Pulled. |
| Resource exports | mass resource download, mass instance export, exportResource | Pulled. Records resource.exported. |
| Dependencies of a deployment | The provisioner | Snapshotted when the deployment is created. |
Event destinations​
An event destination receives the audit log events that you select. Create one in the UI, with mass event destination create, with createEventDestination, or with the Terraform provider's massdriver_event_destination.
| Behavior | Summary |
|---|---|
| Selection | Event types (deployment.failed, deployment.*, or all), then exact-match Attributes such as md-environment, then an optional jq Condition. |
| Preview | mass event destination preview and previewEventDestination show the recent events that a selection matches, before you create the destination. |
| Test | Send test event or testEventDestination sends one event_destination.tested event and shows the result. |
| Payload | One CloudEvent per event. The HTTP adapter signs it with Standard Webhooks. |
| Order and duplicates | Any order. At least once. Drop duplicates by the event id. |
| Retries | Exponential backoff from 30 seconds to 1 hour, 10 attempts. Then the delivery is FAILED. |
| Deliveries | PENDING, DELIVERED, SKIPPED, or FAILED. mass event destination deliveries lists them. |
| Redelivery | mass event destination redeliver and redeliverEvents send failed events again with all their attempts. |
| Pause and resume | A paused destination keeps its deliveries and sends them on resume. Massdriver pauses a destination after 24 hours of failed sends. |
A new destination gets events that occur after you create it. To act on events, run an automation behind an HTTP destination.
Event types​
A destination selects from these event types. mass event type list, the eventTypes query, and the Terraform provider's massdriver_event_types data source list them with their descriptions and metadata fields. Event Reference lists the fields of each entity.
| Entity | Actions |
|---|---|
deployment | created, proposed, approved, rejected, enqueued, started, completed, failed, aborted |
instance | created, updated, deleted, orphaned, moved |
connection | created, deleted |
remote_reference | assigned, unset |
resource | imported, updated, deleted, provisioned, exported |
resource_type | published, deleted |
repo | published, created, updated, deleted |
project | created, updated, deleted, cloned |
environment | created, updated, deleted, forked |
environment_default | created, deleted |
component | created, updated, deleted |
link | created, deleted |
secret | set, unset |
stash_entry | set, deleted |
alarm | created, updated, deleted |
alarm_state | created |
organization | created, updated |
account | registered |
access_token | created, revoked |
service_account | created, updated, deleted |
group | created, updated, deleted |
group_invitation | accepted, revoked |
group_membership | added, removed |
custom_attribute | created, updated, deleted |
event_destination | created, updated, paused, resumed, redelivered, lagging, caught_up, deleted |
The event type is <entity>.<action>, such as resource.provisioned.
GraphQL subscriptions​
The GraphQL API pushes changes over a WebSocket. The Massdriver UI uses the same subscriptions. A subscription sends only the events that occur while it is connected. An event about an entity that you cannot view arrives as null.
| Subscription | Sends |
|---|---|
organizationEvents | New projects, new repositories, and published bundle versions |
projectEvents | The project, its environments, components, and links |
environmentEvents | The environment, its defaults, instances, connections, and alarms |
instanceEvents | The instance's configuration, deployments, incoming connections, and alarms |
deploymentEvents | Status changes of one deployment |
deploymentLogs | Log batches of one deployment |
alphaStashEvents | Stash sets and deletes in a project, and in one environment |
The project, environment, instance, and deployment subscriptions also send stash changes. Refer to Stash: Events.
API and CLI reads​
The GraphQL API and mass read back the inputs above, with commands such as mass deployment get, mass resource list, mass alpha stash get, and mass event destination deliveries. The auditLogs query returns the audit log, filtered by time, event type, and actor. It holds the same events that destinations receive, including events that occurred before a destination existed.
Resource exports​
mass resource download, mass instance export, and exportResource return a resource's payload with its sensitive fields unmasked, in JSON or in a format that its resource type defines, such as a kubeconfig. Each export records resource.exported. To find exports that revealed a secret, select resource.exported with the condition .data.metadata.contains_secrets == true.
Into a deployment​
A resource leaves Massdriver as the value of a dependency of another instance. The resource reaches that instance through a link, an environment default, or a remote reference. An environment default or a remote reference needs a grant of the resource to the instance's environment.
When a deployment is created, Massdriver snapshots the current payload of each resource that fills a dependency. The provisioner receives the snapshot with the params, the instance's secrets, the deployment's token as MASSDRIVER_TOKEN, and, when enabled, deployment identity tokens. A changed resource does not redeploy its dependents. They get the new payload on their next deployment. To deploy them when an instance finishes, run autodeploy-downstream.
A deployment can also read the stash of its instance, environment, component, and project, and the stash of each instance whose resources fill its dependencies. Refer to Stash for Provisioners.