You can use hooks to execute actions at specific stages of stack deploy and undeploy operations. Takomo has one built-in hooks, and you can also implement your own.
In a stack configuration, you choose which type of hook to use by providing value to the
type property. You also need to give a name for each hook. In addition to these two mandatory properties, each hook type may have its own set of additional properties.
The command hook executes the specified shell command.
Here are the properties of the Command hook:
Type of the hook, this must be cmd.
Name of the hook.
Shell command to execute.
The working directory from where the shell command is executed.
Make the current stack's AWS credentials available for the shell command. Defaults to false. Added in Takomo v3.5.0
Make the current stack's region available for the shell command. Defaults to false. Added in Takomo v3.11.0.
Controls how to capture the output of the executed shell command. By default, all output is captured. To capture only the last line, set this to last-line.
The following environment variables are available in the shell command:
The current stack operation stage.
The current stack operation.
The current stack operation status, not present in before stage
Any output the hook prints to the stdout is captured and exposed for other hooks.
A command hook that runs a simple shell command:
- name: my-hookcommand: echo 'hello world'
A command hook that exposes the current stack's AWS credentials to the shell command:
- name: my-another-hookexposeStackCredentials: truecommand: aws sts get-caller-identity