Skip to content
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

Lookup terraform binary in system path before attempting to install it #77

Closed

Conversation

syndicut
Copy link

When using terraform-plugin-docs in ci process it is slow and sometimes impossible to download terraform binary every time.
So I propose to first lookup terraform binary in system path and use it and fallback to downloading it.

@hashicorp-cla
Copy link

hashicorp-cla commented Aug 11, 2021

CLA assistant check
All committers have signed the CLA.

@syndicut
Copy link
Author

@paultyng Can you have a look at this?

@paultyng
Copy link
Contributor

@syndicut I no longer work at HashiCorp

@syndicut
Copy link
Author

syndicut commented Aug 25, 2021

@syndicut I no longer work at HashiCorp

ok, sorry for bothering
can you suggest any maintainer/co-maintainer at HashiCorp?

@OJFord
Copy link
Contributor

OJFord commented Nov 12, 2021

@bflad
Copy link
Contributor

bflad commented Mar 14, 2022

Hi @syndicut 👋 Thank you for raising this and apologies for the delayed review. Using an existing Terraform CLI binary is certainly a welcome enhancement.

We recently needed to switch from the removed github.com/hashicorp/terraform-exec/tfinstall to github.com/hashicorp/hc-install. To that end, could you rebase and update this pull request (or create a new one) that uses hc-install instead? When adding the local installer, we should also update the code to fallback to installing the latest Terraform CLI version, rather than remaining hardcoded to 1.0.5.

Something like this should do the trick:

sources := []src.Source{
	&fs.AnyVersion{
		Product: &product.Terraform,
	},
	&checkpoint.LatestVersion{
		InstallDir: tmpDir,
		Product:    product.Terraform,
	},
}

installer := install.NewInstaller()
tfBin, err := installer.Ensure(context.Background(), sources)

if err != nil {
	return nil, err
}

Please reach out if you have any questions.

@bflad bflad self-assigned this Mar 14, 2022
@bflad bflad added the enhancement New feature or request label Mar 14, 2022
@bflad bflad added this to the v0.7.0 milestone Mar 14, 2022
@bflad
Copy link
Contributor

bflad commented Mar 15, 2022

Closing, with permission, in preference of #124 👍

@bflad bflad closed this Mar 15, 2022
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants