Kubectl Hooks

Here are some examples of running custom hooks before and after the kubectl commands.


  execute: "kubectl apply -f .kubes/shared/namespace.yaml",

  execute: "echo 'delete hook',

You can use hooks to do things that may not make sense to do in the .kubes/resources definition. Here’s an example of automatically creating the namespace.


apiVersion: v1
kind: Namespace
  name: demo

exit on fail

By default, if the hook commands fail, then terraspace will exit with the original hook error code. You can change this behavior with the exit_on_fail option.

  execute: "/command/will/fail/but/will/continue",
  exit_on_fail: false,