Common Examples

Using Your Own Kubernetes Config

If you need more control over how terraform is executed, you can define a Runtime Extensions yourself instead. Inside your runtime config, mark the extension type as TERRAFORM:

  name: my-terraform-runner
    type: TERRAFORM
    ... # the rest of extension config goes here

Make sure that:

  1. Your fetch command is defined and ends with terraform plan -detailed-exitcode. -detailed-exitcode causes terraform to exit 0 when there are no changes, 1 on errors, and 2 if there are changes - exactly what the Runtime Extension interface expects.
  2. Your apply command ends with terraform apply.
  3. terraform init is run before both fetch and apply.
  4. Pass a -lock-timeout (we use 60s) to both terraform plan and terraform apply, as we run plan continuously in a loop and so cause the two commands to conflict.

As this is now your own Runtime Extension, you can define whatever parameters you would like to expose to your services.