Workflows perform a set of tasks and multiple tasks make up a workflow. There are three main groupings of tasks:

  • Terraform
  • Setup
  • Scripts

Tasks by Name and Order of Execution

Tasks used to create/update resources are used in the normal workflow process. This is the list in order of execution:

  • setup
  • preinit
  • init
  • postinit
  • preplan
  • plan
  • postplan
  • preapply
  • apply
  • postapply

Tasks uses to destroy resources created by terraform are used when the user deletes the tf resource from Kubernetes. For a delete workflow to be run, another condition in the tf resource’s spec must exist; ignoreDelete: false

This is the list of deletion tasks in order of execution:

  • setup-delete
  • preinit-delete
  • init-delete
  • postinit-delete
  • preplan-delete
  • plan-delete
  • postplan-delete
  • preapply-delete
  • apply-delete
  • postapply-delete

Terraform

Terraform is the task that calls on terraform to perform the init | plan | apply workflow. Those familiar with Terraform are familiar with these steps because it’s at the heart of how terraform is used. In Terraform Operator, each one of these steps is a separate task. The name of each task is also creatively labeled as:

  • init
  • plan
  • apply

Setup

No terraform is without setup. The setup task is responsible for downloading the terraform module and any other files required to perform a successful terraform run.

Scripts

These are special tasks that are executed between Terraform tasks. Terraform users understand that not every terraform workflow is a standalone execution; it would be nice if it was.

Scripts allow users to write their own logic that runs as as a stage in the Terraform Operator workflow. This could include some file manipulation, ensure vars, run tests, or in general, anything.

Modifying and Extending Tasks

To make modification to the executing script of any of the tasks, try and get familiar with the tasks repo https://github.com/GalleyBytes/terraform-operator-tasks. This separation of the tasks from the main repo is brand new. More documentation is soon to follow.

Check back soon for a better guide on modifying tasks.