8.3.2. Variable Sets and Run Triggers
💡 First Principle: Variable sets eliminate copy-pasting the same variables across workspaces, and run triggers wire one workspace's apply to start another's run — so together they reduce duplication and express dependencies between workspaces, much like locals and references do within a configuration.
A variable set is a reusable collection of variables (and environment variables, like cloud credentials) that you define once and apply to multiple workspaces or to an entire project — avoiding repetition and keeping shared values consistent. A run trigger connects workspaces so that a successful apply in a source workspace automatically queues a run in a dependent workspace — useful when one workspace's outputs feed another (e.g., a shared-network workspace triggering app workspaces).
⚠️ Exam Trap: Variable sets share variables across many workspaces (don't confuse with per-workspace variables). Run triggers create cross-workspace run dependencies (don't confuse with depends_on, which orders resources within one configuration). Match each feature to the right scope.
Reflection Question: Why is a variable set a better way to supply cloud credentials to twenty workspaces than setting them individually in each?