terraform-operator

module
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2024 License: Apache-2.0

README

Terraform Operator

A Kubernetes CRD and Controller to handle Terraform operations by generating k8s pods catered to perform Terraform workflows

Terraform Operator Logo

What is terraform-operator?

This project is:

  • A way to run Terraform in Kubernetes by defining Terraform deployments as Kubernetes manifests
  • A controller that configures and starts Terraform Workflows when it sees changes to the Kubernetes manifest
  • Workflow runner pods that execute Terraform plan/apply and other user-defined scripts

This project is not:

  • An HCL to YAML converter or vice versa
  • A Terraform Module or Registry

Installation

The preferred method is to use helm. See Install using Helm on the docs.

Another simple method is to install the resources under deploy & deploy/crds

git clone https://github.com/galleybytes/terraform-operator.git
cd terraform-operator
kubectl apply -f deploy/bundles/v0.16.0/v0.16.0.yaml

See more installation options.

Docs

Visit http://tf.galleybytes.com to read the docs.

Terraform Operator Workflow Diagram

Here are some other projects that enhance the experience of Terraform Operator.

Debug With tfo CLI

Terraform is great, but every now and then, a module takes a turn for the worse and the workflow fails. When this happens, a terraform workflow will need to be "debugged."

Fortunately, the tfo cli (https://github.com/isaaguilar/terraform-operator-cli) can be used to start a debug pod which is connected directly to the same terraform session the workflow runs. It does so by reading the TFO resource and generates a pod with the same environment vars, ConfigMaps, Secrets, and ServiceAccount as a regular workflow pod. Then it drops the user in a shell directly in the main module.

tfo debug my-tfo-resource --namespace default

The user should be ready to rock-n-roll and show off their mad debugging skills.

Connecting to my-tfo-resource-ca6ajn94-v2-debug-qmjd5.....

Try running 'terraform init'

/home/tfo-runner/generations/2/main$

Happy debugging!

Join the Community

Currently, I'm experimenting with a Discord channel. It may be tough when taking into account juggling a full time job and full time parenting, but I'll see what comes of it. Join the channel https://discord.gg/J5vRmT2PWg

Directories

Path Synopsis
cmd
pkg
apis/tf
Package tf contains tf API versions.
Package tf contains tf API versions.
apis/tf/v1beta1
Package v1beta1 contains API Schema definitions for the tf v1beta1 API group +k8s:deepcopy-gen=package,register +groupName=tf.galleybytes.com
Package v1beta1 contains API Schema definitions for the tf v1beta1 API group +k8s:deepcopy-gen=package,register +groupName=tf.galleybytes.com
client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/clientset/versioned/typed/tf/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/clientset/versioned/typed/tf/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
projects

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL