gravitational / teleport-plugins

Set of plugins for Teleport
Apache License 2.0
81 stars 82 forks source link

Add a `go.mod` for the terraform provider #577

Closed jaxxstorm closed 1 month ago

jaxxstorm commented 2 years ago

I would like to bridge the terraform provider into a pulumi provider, but that's not currently possible without a go.mod

Would you folks be able to add a go.mod so I can reference it :)

marcoandredinis commented 2 years ago

We do have a go.mod in the project's root Do you need it to be within the terraform folder?

jaxxstorm commented 1 year ago

The go.mod currently isn't usable for a few reasons:

go get github.com/gravitational/teleport-plugins@v10.1.4
go: github.com/gravitational/teleport-plugins@v10.1.4: invalid version: module contains a go.mod file, so module path must match major version ("github.com/gravitational/teleport-plugins/v10")

Trying to pull the version by commit throws an error due to the java apps in the repo:

go get github.com/gravitational/teleport-plugins@5c50e63fa42233f4e2abe5b168c339cccc6a0ba5
go: downloading github.com/gravitational/teleport-plugins v0.0.0-20220812065221-5c50e63fa422
go: github.com/gravitational/teleport-plugins@5c50e63fa42233f4e2abe5b168c339cccc6a0ba5: create zip: apps/example-tomcat-jwt/eclipseproject/sampleaap/WebContent/img/genericperson.png:Zone.Identifier:$DATA: malformed file path "apps/example-tomcat-jwt/eclipseproject/sampleaap/WebContent/img/genericperson.png:Zone.Identifier:$DATA": invalid char ':
fheinecke commented 1 month ago

Hi @jaxxstorm, we've merged plugins into the main Teleport repo, and this file is now available here.

Unfortunately this does not solve the issue. I did some testing and it looks like we cannot fix this without a large restructuring due to the following Go issues:

My best recommendation is that you clone the Teleport repo (as this codebase has been merged there), then use a replace directive in your go.mod to point to the Terraform module. We do something similar for building the plugin binaries as shown here.

This isn't ideal, but I don't see another way around it without a Golang fix, or a major change to how we build and version plugins.

hugoShaka commented 1 month ago

You don't need to clone the whole teleport repo, just create equivalent replace to the ones we have in the terraform module. For the replace teleport ../ and teleport/api ../api you can refer to the git object instead of the local files.

I will close this issue as we now have a go module for the Terraform provider. Including it is not as simple as doing a go get, but this is feasible now.