Skip to content

fbuinosquy1985/terraform-operator

 
 

Repository files navigation

Terraform Operator

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


⚠️ ⚠️ ⚠️

master branch is currently under heavy development. Most of the docs are now outdated but will be updated soon. For information on why I'm doing these changes, see https://github.com/isaaguilar/terraform-operator/blob/feature/terraform-runner-container-states/docs/container-states.md for an overview.

I'm also going to try to get a roadmap up soon.

Stay tuned!


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 Kubernetes Jobs when it sees changes to the Kubernetes manifest
  • A Terraform runner which runs Terraform plan/apply, and can also perform pre and post scripts

This project is not:

  • An HCL to YAML converter or vice versa
  • A Terraform module definition

Quick Start

Install the operator with helm:

helm repo add isaaguilar https://isaaguilar.github.io/helm-charts
helm repo update
helm install terraform-operator isaaguilar/terraform-operator

Then start running workloads. For example from this repo, run:

kubectl apply -f examples/complete-examples/simple-template.yaml

A terraform runner pod should appear shortly. The runner executes the terraform module configured in spec.terraformModule.address. In the example, the module configured is https://github.com/cloudposse/terraform-example-module.git?ref=master which simply generates a random number.

Development

Requires the following installed on your system:

  • go >= v1.15.0

Run make install to install or update the crd in your current-context cluster.

Finally, run make run to start the controller to operate in your current-context cluster.

Docs

Installation

Configurations

Advanced Topics

Architecture

Contributing

Issues and Pull Requests are welcomed.

About

A Kubernetes CRD to handle terraform operations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 86.8%
  • Shell 8.8%
  • Makefile 2.8%
  • Dockerfile 1.4%
  • HCL 0.2%