jrhouston / tfk8s

A tool for converting Kubernetes YAML manifests to Terraform HCL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to Install

chrisaddams opened this issue · comments

Hi, It doesn't seem clear how to install this. I've cloned the repo and run Make Install, but I can't get passed that. Is there a step I'm missing before I'm able to use tfk8s as a command?

Hey @chrisaddams thanks for opening this. Can you show me the output you get when you run make install? At the moment this just runs go install, so the binary will be built and land wherever go is configured to install binaries on your system (for me it's $(go env GOPATH)/bin)

I'm hoping to set up binary releases for this soon so you don't have to build it yourself.

➜ tfk8s git:(master) go install
tfk8s.go:11:2: cannot find package "github.com/hashicorp/terraform/repl" in any of:
/usr/lib/go-1.10/src/github.com/hashicorp/terraform/repl (from $GOROOT)
/home/errogaht/go/src/github.com/hashicorp/terraform/repl (from $GOPATH)
tfk8s.go:14:2: cannot find package "github.com/spf13/pflag" in any of:
/usr/lib/go-1.10/src/github.com/spf13/pflag (from $GOROOT)
/home/errogaht/go/src/github.com/spf13/pflag (from $GOPATH)
tfk8s.go:12:2: cannot find package "gopkg.in/yaml.v2" in any of:
/usr/lib/go-1.10/src/gopkg.in/yaml.v2 (from $GOROOT)
/home/errogaht/go/src/gopkg.in/yaml.v2 (from $GOPATH)

@errogaht It looks like you're on go 1.10 from looking at the paths in your output. This project uses go modules so you'll need a newer version of go to build it.

I found using go get will quickly install it.

go get -u github.com/jrhouston/tfk8s

I'm using go 1.14, thanks for the handy tool btw.

For Homebrew users, I have added tfk8s to my own tap, so you can now install it by running brew install tenzer/tap/tfk8s. There are bottles available for macOS x86 and ARM64 plus Linux x86.

Trying to install this, but it fails with:
github.com/jrhouston/tfk8s imports
github.com/hashicorp/terraform/repl: cannot find module providing package github.com/hashicorp/terraform/repl

go version go1.16.5 linux/amd64

Ah looks like hashicorp/terraform@36d0a50 made the repl package internal, so it's breaking go get even though I have the version pinned in go.mod.

go install github.com/jrhouston/tfk8s@latest

still works for me on go1.16.5.

go install github.com/jrhouston/tfk8s@latest
(worked for me)
go version go1.18.2 windows/amd64
On windows 10 Git Bash

This command have generated a Windows/amd64 executable in the Linux environment, and then I have moved the compiled file to the Windows place.

env GOOS=windows GOARCH=amd64 go install github.com/jrhouston/tfk8s@latest

I did this in a Docker context. See the dockerfile below.

FROM golang:alpine
RUN apk --update add --no-cache git 
RUN go install github.com/googlecloudplatform/gcsfuse@master

The compiled file will be find in path /go/bin/windows_amd64