Hello Terraform Operator Example

Create your first Terraform resource using Terraform-operator

Create a Terraform resource by running this hello_world example:

printf 'apiVersion: tf.isaaguilar.com/v1alpha2
kind: Terraform
  name: hello-tfo
  namespace: "default"
  terraformVersion: 1.3.0-beta1
    source: https://github.com/isaaguilar/simple-aws-tf-modules.git//create_file

  backend: |-
    terraform {
      backend "kubernetes" {
        secret_suffix    = "hello-tfo"
        in_cluster_config  = true
        namespace = "default"

  keepCompletedPods: true
  ignoreDelete: true
'|kubectl apply -f-
backend "kubernetes" is an available backend for Terraform v0.13+.

See the pods getting created:

kubectl get po -w| grep hello-tfo

Finally, go ahead and delete the resource:

kubectl delete tf hello-tfo

The default behavior is to clean up the terraform resource. Watch the delete workflow being executed:

The delete will go by fast for this sample module, so the following command may not show any results. If that's the case, the terraform was already cleaned up.
kubectl get po -w| grep hello-tfo