Closed galindro closed 3 years ago
I could workaround the issue by exporting the following env var: GO111MODULE=on
as mentioned here.
I think that should be the default with Go 1.13 and newer. But yes the go modules mode is required. All other dependency tools for go are basically deprecated.
Shouldn't this info be placed on install instructions? Not everyone is familiar with golang...
Those instructions are mostly for developing with the provider. Most users should go the official registry route and use
terraform {
required_providers {
foreman = {
source = "HanseMerkur/foreman"
version = "0.3.1"
}
}
}
provider "foreman" {
# Configuration options
}
as described here https://registry.terraform.io/providers/HanseMerkur/foreman/latest That approach is way more stable and automatically selects the correct architecture etc. But yes the README needs some updates to point normal users in the right direction.
Oh nice. Didn't knew that it was published on terraform registry. I'll close this ticket.
@lhw the required_providers is a terraform 0.13 feature. For 0.12 and bellow, we still need to install the provider in an old fashion way. That's why it is better to add the env var tricky on the docs. There is no way to select the source on TF 0.12. https://www.terraform.io/docs/configuration/provider-requirements.html#v0-12-compatible-provider-requirements
Just realized that if you set that environment variable, it seems that the sources aren't updated locally. To workaround, I deleted the root local package folder (in my case ~/go/src/github.com/HanseMerkur/), unset the GO111MODULE env var, and I did a go get -u github.com:HanseMerkur/terraform-provider-foreman
. Some errors will be displayed, but they can be ignored. Then, I could cd to the folder and could compile it.
But I think that the above workaround shall only work if you previously ran go get -u github.com:HanseMerkur/terraform-provider-foreman
with the GO111MODULE=yes env var set. Dirty installation process, but seems to work.
I'm trying to install the newest plugin version, but I'm getting this error:
According to https://github.com/hashicorp/hcl/issues/371, the error occurs because HCL 2 can be automatically installed only in Go Modules mode.
How could I install this plugin in Go Modules mode? The instructions are still referring to legacy go get mode.