-
Notifications
You must be signed in to change notification settings - Fork 1.5k
vendor all the required terraform plugins #919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vendor all the required terraform plugins #919
Conversation
|
I'm just starting into this, and we can certainly punt to future work, but it would be great if we could put libvirt support behind a build tag so we could compile releases without it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, love it 👍
pkg/terraform/terraform.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Can we move this to trace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with debug or trace, but if we go with trace we should list it here.
|
Approach looks solid. Just a few NITs. |
time="2018-12-15T01:49:13Z" level=debug msg="Initializing provider plugins..."
time="2018-12-15T01:49:13Z" level=debug msg="- Checking for available provider plugins on https://releases.hashicorp.com..."
time="2018-12-15T01:49:13Z" level=debug msg="- Downloading plugin for provider \"aws\" (1.39.0)..."
time="2018-12-15T01:49:15Z" level=debug
time="2018-12-15T01:49:15Z" level=debug msg="Terraform has been successfully initialized!"Saw this on CI, need to see why it is downloading AWS plugin. Maybe because we set AWS provider version to /hold |
Yeah we should probably drop versions from the Terraform. |
…of plugin dir so terraform now looks for plugins in - `.` - `binary location` - `$HOME/terraform.d/plugins` - `$HOME/terraform.d/plugins/GOOS_GOARCH` - `<tmp terraform workspace>/plugins`
…nownPlugins `KnownPlugins` maps the plugin name (`terraform-provider-<name>`) to a function that runs the plugin
2f50018 to
a54256e
Compare
6417b29 to
7a3f625
Compare
|
So from the ci terraform is not downloading aws plugin. ^^ @wking |
|
/hold cancel |
|
/retest |
|
@crawford @wking the tests are green https://openshift-gce-devel.appspot.com/build/origin-ci-test/pr-logs/pull/openshift_installer/919/pull-ci-openshift-installer-master-e2e-aws/2373 [EDIT]: Oops has to push the commits that change docs for libvirt terraform plugins |
we create symlinks to `<tmp terraform workspace>/plugins` such that terraform calls the installer binary with the `terraform-provider-<plugin name>` as executable name
…t to plugins' name If the os.Args[0] has the terraform plugin's name, we run the corresponding plugin's exec function. By default we always run installer's main.
Added `Gopkg.toml` have specific ignores.. ```console ignored = [ "github.com/libvirt/libvirt-go", "github.com/hashicorp/terraform/*" ] ``` * `github.com/libvirt/libvirt-go` as CGO complains if two vendr directories have same c functions. * `github.com/hashicorp/terraform/*` so that all plugins use the already vendored code in `terraform/exec/vendor`.
1446e59 to
41b4238
Compare
Terraform loads the on disk plugins to `0.0.0` version. unsettting allows us to use the local plugins and prevents terraform from trying to fetch the provider from internet.
The last consumers of the api was removed in openshift@41dd728 The version of the terraform is now tied to the version of the installer, so this is no longer required.
41b4238 to
48e05c7
Compare
setting the `-get-plugins=false` instructs terraform to not fetch any plugins from the ineternet. All the plugins required by installer have to be embedded. This allows us to ensure that all the plugins required are never downloaded from the internet.
48e05c7 to
1ee74db
Compare
|
/lgtm 🎉 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinavdahiya, wking The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
Previously, destroy support was behind TAGS=libvirt_destroy and create support was always built in. But since 3fb4400 (terraform/plugins: add `libvirt`, `aws`, `ignition`, `openstack` to KnownPlugins, 2018-12-14, openshift#919), the bundled libvirt Terraform provider has also been behind libvirt_destroy. That leads to cluster creation failing with: $ openshift-install create cluster ... ERROR Missing required providers. ERROR ERROR The following provider constraints are not met by the currently-installed ERROR provider plugins: ERROR ERROR * libvirt (any version) ERROR ERROR Terraform can automatically download and install plugins to meet the given ERROR constraints, but this step was skipped due to the use of -get-plugins=false ERROR and/or -plugin-dir on the command line. ... With this commit, folks trying to 'create cluster' without libvirt compiled in will get: FATAL failed to fetch Common Manifests: failed to load asset "Install Config": invalid "install-config.yaml" file: platform: Invalid value: types.Platform{AWS:(*aws.Platform)(nil), Libvirt:(*libvirt.Platform)(0xc4209511f0), OpenStack:(*openstack.Platform)(nil)}: platform must be one of: aws, openstack before we get to Terraform. Now that the build tag guards both creation and deletion, I've renamed it from 'libvirt_destroy' to the unqualified 'libvirt'. I've also adjusted the install-config validation testing to use regular expressions so we can distinguish between failures because libvirt was not compiled in as a valid platform and failures because some portion of the libvirt configuration was broken. In order to get stable error messages for comparison, I've added some strings.Sort calls for various allowed-value string-slice computations.
/cc @crawford @wking @eparis