Skip to main content

Dependencies & Links

A dependency is a slot a bundle declares under dependencies in its massdriver.yaml: a resource type it needs from another bundle. A slot is filled in one of three ways:

  • Link: a line drawn on the project canvas from one component's output to another component's input. In each environment, a link is realized as a connection between the two instances.
  • Environment default: a resource the environment supplies to every instance that depends on its type.
  • Remote reference: a per-instance override that points the slot at a resource from another project or an imported resource. It takes priority over a link or environment default. Set it with mass instance remote-reference set.

Links were previously called connections in the UI and docs. In the v2 API, Link is the blueprint edge between components and Connection is its realization between instances.

Links are directed. They flow from left to right and form a directed acyclic graph of your infrastructure and applications.

A dotted line means the source resource has not been provisioned yet. A solid line means it has.

A link is drawn once on the project blueprint, but environments can run different bundle versions. Each link records a version range for the source component and one for the destination component.

A link applies in an environment only when the bundle versions there satisfy both ranges.

PROJECT BLUEPRINTtwo links on db.network, one per version pairvpc ~1 → db ~1db.network reads vpc.networkvpc ~1 → db ~2db.network reads vpc.private_networkboth environments run aws-vpc 1.4.0DEVELOPMENTdb 2.0.0wired to vpc.private_networkSTAGINGdb 1.2.0wired to vpc.networkdb 2.0.0wired to vpc.private_networkPRODUCTIONnot upgradeddb 1.2.0wired to vpc.networkeach environment materializes the link whose version ranges its deployed bundles satisfystaging upgraded to db 2.0.0 and picked up the vpc ~1 → db ~2 link with no rewiring

How the ranges are set​

You do not type the ranges. When you draw a link, Massdriver reads the bundle version at each end and stores that version's compatibility boundary:

Deployed versionStored rangeReason
1.2.3~1For 1.0.0 and above, the major version is the compatibility boundary
2.0.0~2A new major version is a new contract
0.4.1~0.4Below 1.0.0, the minor version is the compatibility boundary
1.2.3-dev.20060102T150405Z~1A development release shares its base version's boundary

A development release satisfies the same range as the version it is based on, so a link stays wired while you test a -dev build.

Bundles below 1.0.0 narrow faster

A 0.x bundle changes its compatibility boundary on every minor bump. A component moving from 0.4.1 to 0.5.0 leaves the ~0.4 range, and the link drawn at 0.4.1 no longer applies to it. Draw the link again at the new version, or publish 1.0.0 so the boundary widens to the major version.

A destination field can carry several links, as long as no two of them could apply at the same time. Massdriver rejects a new link when its source range and its destination range both overlap an existing link on that field, because a single pair of deployed versions would then satisfy two at once.

Non-overlapping pairs are what make a staged rollout work. A field can hold vpc ~1 → db ~1 and vpc ~1 → db ~2 together. Every environment satisfies exactly one of them, so staging moves to the new major version on its own schedule and production keeps the wiring it already had.

Seeing what an instance is bound to​

Open an instance and select the Dependencies tab. Each row shows the resource type and the version range the slot accepts, and the instance currently filling it. The Resources tab lists what the instance produces and who consumes it.

Params from dependencies​

The $md.enum annotation turns a param into a dropdown whose options come from a dependency's data. A bundle that depends on a VPC can offer its subnets, and one that depends on a database cluster can offer its databases.

See Massdriver Annotations.

Click the X at the middle of the line (Delete link), or run mass component unlink.

caution

Removing a link without decommissioning the dependent component can leave an inconsistent state and orphaned resources.