All Projects → jrhouston → Tfk8s

jrhouston / Tfk8s

Licence: mit
A tool for converting Kubernetes YAML manifests to Terraform HCL

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Tfk8s

K2tf
Kubernetes YAML to Terraform HCL converter
Stars: ✭ 477 (+185.63%)
Mutual labels:  terraform, hcl, yaml, converter
Config Lint
Command line tool to validate configuration files
Stars: ✭ 118 (-29.34%)
Mutual labels:  terraform, hcl, yaml
Terraform.tmlanguage
Terraform (HCL) configuration file syntax highlighting for Sublime Text 2 and 3
Stars: ✭ 148 (-11.38%)
Mutual labels:  terraform, hcl
Multiregion Terraform
Example multi-region AWS Terraform application
Stars: ✭ 149 (-10.78%)
Mutual labels:  terraform, hcl
Terraform Kubernetes
Example of deploying a Kubernetes cluster to Google Cloud using Terraform
Stars: ✭ 152 (-8.98%)
Mutual labels:  terraform, hcl
Tfupdate
Update version constraints in your Terraform configurations
Stars: ✭ 145 (-13.17%)
Mutual labels:  terraform, hcl
Terraform Aws Labs
Terraform template for AWS provider ☁️
Stars: ✭ 146 (-12.57%)
Mutual labels:  terraform, hcl
Gelatin
Transform text files to XML, JSON, or YAML
Stars: ✭ 150 (-10.18%)
Mutual labels:  yaml, converter
Terraform Vsphere Kubespray
Deploy a Kubernetes HA cluster on VMware vSphere
Stars: ✭ 141 (-15.57%)
Mutual labels:  terraform, hcl
Terrible
An Ansible playbook that apply the principle of the Infrastructure as Code on a QEMU/KVM environment.
Stars: ✭ 161 (-3.59%)
Mutual labels:  terraform, yaml
Terraform Aws Kubernetes
Terraform module for Kubernetes setup on AWS
Stars: ✭ 159 (-4.79%)
Mutual labels:  terraform, hcl
Terraform Aws Components
Opinionated, self-contained Terraform root modules that each solve one, specific problem
Stars: ✭ 168 (+0.6%)
Mutual labels:  terraform, hcl
Terraform Aws Landing Zone
Terraform Module for AWS Landing Zone
Stars: ✭ 142 (-14.97%)
Mutual labels:  terraform, hcl
Kubify
Terraform Template to Setup a Kubernetes Cluster on OpenStack/AWS/Azure
Stars: ✭ 142 (-14.97%)
Mutual labels:  terraform, hcl
Terraform Google Vault
Modular deployment of Vault on Google Compute Engine with Terraform
Stars: ✭ 147 (-11.98%)
Mutual labels:  terraform, hcl
Terraform With Circleci Example
This is an example of automatic deployments of your infrastructure using terraform and CircleCI 2.0 workflows
Stars: ✭ 142 (-14.97%)
Mutual labels:  terraform, hcl
Terraform Aws Eks
Terraform module to create an Elastic Kubernetes (EKS) cluster and associated worker instances on AWS
Stars: ✭ 2,464 (+1375.45%)
Mutual labels:  terraform, hcl
Terraform Aws Cloudfront S3 Cdn
Terraform module to easily provision CloudFront CDN backed by an S3 origin
Stars: ✭ 162 (-2.99%)
Mutual labels:  terraform, hcl
Terraform Aws Cicd
Terraform Module for CI/CD with AWS Code Pipeline and Code Build
Stars: ✭ 138 (-17.37%)
Mutual labels:  terraform, hcl
Example Pragmatic Terraform On Aws
技術書典6で頒布した『Pragmatic Terraform on AWS 』のサンプルコードを公開しています
Stars: ✭ 140 (-16.17%)
Mutual labels:  terraform, hcl

tfk8s

tfk8s is a tool that makes it easier to work with the Terraform Kubernetes Provider.

If you want to copy examples from the Kubernetes documentation or migrate existing YAML manifests and use them with Terraform without having to convert YAML to HCL by hand, this tool is for you.

Demo

Features

  • Convert a YAML file containing multiple manifests
  • Strip out server side fields when piping kubectl get $R -o yaml | tfk8s --strip

Install

For the moment, clone this repo and run:

make install

If Go's bin directory is not in your PATH you will need to add it:

export PATH=$PATH:$(go env GOPATH)/bin

Usage

Creating Terraform configurations

tfk8s -f input.yaml -o output.tf

or, using pipes:

cat input.yaml | tfk8s > output.tf

input.yaml:

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: test
data:
  TEST: test

✨✨ magically becomes ✨✨

output.tf:

resource "kubernetes_manifest_hcl" "configmap_test" {
  manifest = {
    "apiVersion" = "v1"
    "data" = {
      "TEST" = "test"
    }
    "kind" = "ConfigMap"
    "metadata" = {
      "name" = "test"
    }
  }
}

Use with kubectl to output maps instead of YAML

kubectl get ns default -o yaml | tfk8s -M
{
  "apiVersion" = "v1"
  "kind" = "Namespace"
  "metadata" = {
    "creationTimestamp" = "2020-05-02T15:01:32Z"
    "name" = "default"
    "resourceVersion" = "147"
    "selfLink" = "/api/v1/namespaces/default"
    "uid" = "6ac3424c-07a4-4a69-86ae-cc7a4ae72be3"
  }
  "spec" = {
    "finalizers" = [
      "kubernetes",
    ]
  }
  "status" = {
    "phase" = "Active"
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].