tfk8s

Table of contents

  1. tfk8s
    1. Information
    2. Releases
    3. Installation
    4. Completion
    5. Usage
    6. Examples
    7. Links

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


Information

Source | Tracker | VCS | QA | Bugs


Releases

  • 0.1.10-2 (sid | unstable )

If you are using an unlisted debian version probably that means this package it’s not available.


Installation

apt install tfk8s

Completion

Completions will be installed for bash, zsh and fish shells.


Usage

Usage of tfk8s:
  -f, --file string         Input file containing Kubernetes YAML manifests (default "-")
  -M, --map-only            Output only an HCL map structure
  -o, --output string       Output file to write Terraform config (default "-")
  -p, --provider provider   Provider alias to populate the provider attribute
  -s, --strip               Strip out server side fields - use if you are piping from kubectl get
  -Q, --strip-key-quotes    Strip out quotes from HCL map keys unless they are required.
  -V, --version             Show tool version

asciicast


Examples

Create Terraform configuration from YAML files

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

output.tf

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

See more examples