This module adds the Context Trigger plugin to your Spacelift account.
It will trigger stacks that are using an explicitly attached context when that context changes.
How it works:
- Analyzes the after state of an administrative stack.
- Determines if there are changes to a
spacelift_contextor, if attached to a context, changes to aspacelift_environment_variable/spacelift_mounted_file. - Determines if that context is explicitly attached with a
spacelift_context_attachmentresource. - If the above conditions are all satisfied, it will determine what stacks are attached via the
spacelift_context_attachmentresource and then trigger them.
- Spin up the module (see examples below)
- Add the
trigger_attached_contexts_stackslabel to any administrative stacks that manage contexts and their attachments. - When a context changes that is managed by the stack with that label, any stacks using that context will be triggered.
(See below screenshot, under Apply complete!)

Theres a few things to keep in mind when using this plugin.
- The plugin only works in
administrativestacks. - The plugin does not work with autoattached contexts, the context must be attached with a
spacelift_context_attachmentresource. - If the stack id, or context id is unknown until after apply, the plugin will not work. This is because the plugin needs to know the stack id and context id to trigger the stack.
- This limitation may change in the future.
module "ec2_worker_pool_stack" {
source = "spacelift.io/spacelift-solutions/plugin-context-trigger/spacelift"
# Required Variables
spacelift_domain = "https://spacelift-solutions.app.spacelift.io"
# Optional Variables
name = "plugin-context-trigger"
space_id = "root"
}| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| name | Name of the context | string |
"trigger_attached_contexts_stacks" |
no |
| space_id | ID of the space | string |
"root" |
no |
| spacelift_domain | fqdn of the spacelift instance (https://spacelift-solutions.app.spacelift.io) | string |
n/a | yes |