Skip to main content

Manage Lifecycle Events with Hooks

Atmos supports the ability to take action at various points in the lifecycle of your components. This is done by configuring the hooks section in your stack manifest for the component that you want to take action on.

Hooks Schema

The hooks section schema is as follows:

components:
terraform:
top-level-component1:
hooks:
store-outputs:
events:
- after-terraform-apply
command: store
name: prod/ssm
outputs:
vpc_id: .id

Supported Lifecycle Events

Atmos supports the following lifecycle events:

  • after-terraform-apply (this event is triggered after the atmos terraform apply or atmos terraform deploy command is run)

Supported Commands

store

The store command is used to write data to a remote store.

hooks.[hook_name]
This map key is the name you want to give to the hook. This must be unique for each hook in the component.
hooks.[hook_name].events

This is a list of Supported Lifecycle Events that should trigger running the command.

hooks.[hook_name].command
Must be set to store
hooks.[hook_name].name
The name of the store to use.
hooks.[hook_name].outputs

A map of values that will be written to the store under the key for this component. The key is the name of the key in the store. The value is the value to write to the store. If the value begins with a dot (.), it will be treated as a Terraform output and the value will be retrieved from the Terraform state for the current component.