Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sl1pm4t/k2tf
Kubernetes YAML to Terraform HCL converter
https://github.com/sl1pm4t/k2tf
command-line-tool converter hashicorp hashicorp-terraform hcl kubernetes terraform tool utility yaml
Last synced: about 3 hours ago
JSON representation
Kubernetes YAML to Terraform HCL converter
- Host: GitHub
- URL: https://github.com/sl1pm4t/k2tf
- Owner: sl1pm4t
- License: mpl-2.0
- Created: 2019-02-24T02:38:32.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-08-07T04:28:59.000Z (4 months ago)
- Last Synced: 2024-12-05T04:02:58.958Z (7 days ago)
- Topics: command-line-tool, converter, hashicorp, hashicorp-terraform, hcl, kubernetes, terraform, tool, utility, yaml
- Language: Go
- Homepage:
- Size: 738 KB
- Stars: 1,195
- Watchers: 17
- Forks: 107
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-terraform - k2tf - Kubernetes YAML to Terraform HCL converter. (Tools / Miscellaneous)
- awesome-tf - k2tf - Kubernetes YAML to Terraform HCL converter. (Tools / Community providers)
- awesome-starts - sl1pm4t/k2tf - Kubernetes YAML to Terraform HCL converter (terraform)
README
# k2tf - Kubernetes YAML to Terraform HCL converter
[![Build Status](https://cloud.drone.io/api/badges/sl1pm4t/k2tf/status.svg)](https://cloud.drone.io/sl1pm4t/k2tf)
[![Go Report Card](https://goreportcard.com/badge/github.com/sl1pm4t/k2tf?)](https://goreportcard.com/report/github.com/sl1pm4t/k2tf)
[![Release](https://img.shields.io/github/release-pre/sl1pm4t/k2tf.svg)](https://github.com/sl1pm4t/k2tf/releases)A tool for converting Kubernetes API Objects (in YAML format) into HashiCorp's Terraform configuration language.
The converted `.tf` files are suitable for use with the [Terraform Kubernetes Provider](https://www.terraform.io/docs/providers/kubernetes/index.html)
[![asciicast](https://asciinema.org/a/5LzAc7Eha7w7dwrktAxcMdpIc.svg)](https://asciinema.org/a/5LzAc7Eha7w7dwrktAxcMdpIc)
## Installation
**Pre-built Binaries**
Download Binary from GitHub [releases](https://github.com/sl1pm4t/k2tf/releases/latest) page.
**Build from source**
_See below_
**Homebrew**
```
$ brew install k2tf
```
**asdf**Use the [asdf-k2tf](https://github.com/carlduevel/asdf-k2tf) plugin.
## Example Usage
**Convert a single YAML file and write generated Terraform config to Stdout**
```
$ k2tf -f test-fixtures/service.yaml
```**Convert a single YAML file and write output to file**
```
$ k2tf -f test-fixtures/service.yaml -o service.tf
```**Convert a directory of Kubernetes YAML files**
```
$ k2tf -f test-fixtures/
```**Read & convert Kubernetes objects directly from a cluster**
```
$ kubectl get deployments -o yaml | ./k2tf -o deployments.tf
```## Building
> **NOTE** Requires a working Golang build environment.
This project uses Golang modules for dependency management, so it can be cloned outside of the `$GOPATH`.
**Clone the repository**
```
$ git clone https://github.com/sl1pm4t/k2tf.git
```**Build**
```
$ cd k2tf
$ make build
```**Run Tests**
```
$ make test
```---
[![Downloads](https://img.shields.io/github/downloads/sl1pm4t/k2tf/total.svg)](https://img.shields.io/github/downloads/sl1pm4t/k2tf/total.svg)