iam-policy-json-to-terraform icon indicating copy to clipboard operation
iam-policy-json-to-terraform copied to clipboard

Add to package managers like homebrew

Open nitrocode opened this issue 5 years ago • 12 comments

Would be nice to install this using a package managers

brew install iam-policy-json-to-terraform
choco install iam-policy-json-to-terraform
scoop install iam-policy-json-to-terraform

Thanks!

nitrocode avatar May 14 '19 17:05 nitrocode

Agreed, this would be very helpful! Unfortunately, has a policy against self-submitting so I might need some help submitting this:

We frown on authors submitting their own work unless it is very popular.

As for choco and scoop, those are windows package managers, correct? I haven't touched windows systems in years so I'm probably not the right person to work on this, help would be much appreciated though!

flosell avatar May 15 '19 00:05 flosell

Cool, I can help with this since I've submitted stuff to all 3. If I don't do it in a week, just comment this thread and make insulting comments and I'll eventually do it 💀 😂

nitrocode avatar May 15 '19 19:05 nitrocode

Awesome, thanks! Let me know if you need any help!

flosell avatar May 16 '19 00:05 flosell

hey, @nitrocode any progress on this?

flosell avatar Jul 14 '19 04:07 flosell

Hey @nitrocode, any update on this?

pascal-hofmann avatar Jan 09 '20 07:01 pascal-hofmann

Hi everyone. Looking at this today. To make the test for the homebrew formula, it would be ideal if this tool had a --version or -v switch that returned its version.

Edit: I'd like to emulate the terraform landscape tool test formula

Edi2:

Also, @flosell how do I compile this locally? I extracted the contents and I'm getting this issue

$ go build
iam-policy-json-to-terraform.go:7:2: cannot find package "github.com/flosell/iam-policy-json-to-terraform/converter" in any of:
	/usr/local/Cellar/go/1.13.6/libexec/src/github.com/flosell/iam-policy-json-to-terraform/converter (from $GOROOT)
	/Users/user/go/src/github.com/flosell/iam-policy-json-to-terraform/converter (from $GOPATH)
$ go install github.com/flosell/iam-policy-json-to-terraform/converter
can't load package: package github.com/flosell/iam-policy-json-to-terraform/converter: cannot find package "github.com/flosell/iam-policy-json-to-terraform/converter" in any of:
	/usr/local/Cellar/go/1.13.6/libexec/src/github.com/flosell/iam-policy-json-to-terraform/converter (from $GOROOT)
	/Users/user/go/src/github.com/flosell/iam-policy-json-to-terraform/converter (from $GOPATH)

Edit3:

This project may be too niche according to the Acceptable Criteria and so it might be best to maintain our own tap.

The following criteria should be done

  • document how to build this tool
  • add a --version or -v that ties into the tag
  • add a homebrew tap
  • document how to install on osx using the tap

Let me know what you think.

nitrocode avatar Jan 10 '20 16:01 nitrocode

Hi @nitrocode, sorry for the late response and thanks for picking this up!

First things first, to your comments (tl;dr: 👍):

  • document how to build this tool : I'll add some notes to the README (edit: done). For your specific issue, see below
  • add a --version or -v that ties into the tag: Makes sense. Let me know if it's something you want to pick up or if you'll need help from me (or someone else who wants to pick it up)
  • add a homebrew tap: I'm guessing what's niche will depend on homebrew maintainers :) But I agree, this project isn't super well-known so I'm fine starting with our own tap
  • document how to install on osx using the tap 👍

Now to your question around building;

In short, the Makefile and Travis will give you some pointers and I just verified in a container that those should work with your golang version (1.13.6):

$ docker run -it -v $(pwd):/go/src/iam-policy-json-to-terraform golang:1.13.6-buster bash -c 'cd /go/src/iam-policy-json-to-terraform/ && (curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh) && make tools vendor test build'
ARCH = amd64
OS = linux
Will install into /go/bin
Fetching https://github.com/golang/dep/releases/latest..
Release Tag = v0.5.4
Fetching https://github.com/golang/dep/releases/tag/v0.5.4..
Fetching https://github.com/golang/dep/releases/download/v0.5.4/dep-linux-amd64..
Setting executable permissions.
Moving executable to /go/bin/dep
go get -u golang.org/x/lint/golint
dep ensure
go test -v ./...
?   	iam-policy-json-to-terraform	[no test files]
=== RUN   TestConvertFromJsonToTerraformHcl
--- PASS: TestConvertFromJsonToTerraformHcl (0.01s)
PASS
ok  	iam-policy-json-to-terraform/converter	0.021s
golint -set_exit_status ./converter
golint -set_exit_status .
go vet ./...
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o iam-policy-json-to-terraform_amd64 *.go
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o iam-policy-json-to-terraform_alpine *.go
GOOS=darwin go build -o iam-policy-json-to-terraform_darwin *.go
GOOS=windows GOARCH=amd64 go build -o iam-policy-json-to-terraform.exe *.go

As far as I remember, golang and dep expected your code to be in specific directories in the $GOPATH so maybe the issue is that you cloned to a different directory?

flosell avatar Jan 12 '20 06:01 flosell

Submitted the formula to homebrew. Hope it gets accepted. If not, we can always create our own tap.

https://github.com/Homebrew/homebrew-core/pull/49921

nitrocode avatar Feb 09 '20 13:02 nitrocode

Thanks a lot for your work on this!

flosell avatar Feb 11 '20 01:02 flosell

brew install iam-policy-json-to-terraform now works, thanks to @nitrocode for the contribution! Leaving this issue open for anyone willing to contribute choco or scoop support.

flosell avatar Feb 20 '20 14:02 flosell

No problem! This looks interesting too. Let's see if the brew formula will have an increase in the rate of stars attributed to this repo as of the update of the README.md on 02/20/2020 (113 so far).

https://star-history.t9t.io/#flosell/iam-policy-json-to-terraform

nitrocode avatar Feb 21 '20 17:02 nitrocode

Btw here are some stats regarding homebrew formula downloads

nitrocode avatar May 16 '20 21:05 nitrocode