Terraform-operator has several options it can handle when it comes to running terraform apply
on a given deployment.
These options are configurable directly under spec
in the Terraform Kubernetes manifest.
applyOnCreate
- Automatically apply Terraform the first time the Kubernetes resource is created. A "first time run" is when the Kubernetes manifest for the Terraform resource has a metadata.generation
equal to 1.
applyOnUpdate
- Automatically apply Terraform when the Kubernetes resource is updated. An "update" is when the Kubernetes manifest for the Terraform resource has a metadata.generation
greater than 1.
applyOnDelete
- Automatically apply a terraform -destroy
when the Kubernetes resource is deleted. Terraform-operator will not run a destroy command when ignoreDelete
is set to true
.
ignoreDelete
- Do not execute a destroy when the Kubernetes resource gets deleted.
When any of the applyOn
vars are set as false
, the user must manually update a Kubernetes ConfigMap.
The configMap name is the "Terraform Kuberentes Resource Name
" + "-action
". When in doubt, the logs of the pod running Terraform will print the ConfigMap name to update.
Update the value of data.action
with one of following two options:
- "
apply
" - Will continue the script withterraform apply
and any postRun scripts. - "
abort
" - Will exit the terraform-execution pod