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

Error message when Terraform CLI cannot be loaded from sources does not list sources #133

Open
gdavison opened this issue Jun 6, 2023 · 3 comments · May be fixed by #138
Open

Error message when Terraform CLI cannot be loaded from sources does not list sources #133

gdavison opened this issue Jun 6, 2023 · 3 comments · May be fixed by #138
Assignees
Labels
bug Something isn't working

Comments

@gdavison
Copy link
Contributor

gdavison commented Jun 6, 2023

terraform-plugin-testing version

v1.2.0

Expected Behavior

When the Terraform CLI cannot be found, an error message like

cannot run Terraform provider tests: failed to find or install Terraform CLI from [<description of source> <description of source>]: ...

should be returned.

Actual Behavior

The error message was

cannot run Terraform provider tests: failed to find or install Terraform CLI from [0xc0018cba40 0xc005f65180]: ...

Steps to Reproduce

Fail to locate the Terraform CLI when running tests, e.g. a network failure

@gdavison gdavison added the bug Something isn't working label Jun 6, 2023
@austinvalle austinvalle linked a pull request Jun 12, 2023 that will close this issue
@austinvalle
Copy link
Member

Hey @gdavison 👋🏻 , thanks for submitting the issue.

We're considering whether we need to include the description of the source if the underlying error has sufficient info. (as the upstream hc-install does not implement a friendly Stringer method for describing each source)

From my testing, it seems some (haven't tested all) sources return enough information to describe the error without extra code, such as:

# Example w/ non-existent version
cannot run Terraform provider tests: error ensuring Terraform CLI binary: failed to obtain product version from "https://releases.hashicorp.com/terraform/1.5.2/index.json": 404 Not Found

# Example w/ network error
cannot run Terraform provider tests: error ensuring Terraform CLI binary: Get "https://releases.hashicorp.com/terraform/1.5.0/index.json": dial tcp: lookup releases.hashicorp.com: no such host

Did you happen to run into an error message that wasn't helpful? If so I can submit a change to the upstream hc-install. Otherwise we might just remove that code attempting to print the source detail as it'll just keep printing memory addresses 😆

@austinvalle austinvalle added the waiting-response Issues or pull requests waiting for an external response label Jun 12, 2023
@gdavison
Copy link
Contributor Author

I don't remember specifically what I was trying at that point. IIRC, I think we had some intermittent CI failures because of momentary networking failures, even though the Terraform CLI should have already been on the machine, and I was trying to figure out what was happening.

I don't remember if the individual sources gave their own errors. Having the memory addresses instead of a useful description of the source was frustrating, more that anything. Maybe the proper place for the bug report is hc-install

@github-actions github-actions bot removed the waiting-response Issues or pull requests waiting for an external response label Jun 23, 2023
@austinvalle
Copy link
Member

Ah gotcha, that makes sense. I'll keep an eye on that issue you opened, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants