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

unexpected Content-Type when running installer.Install #59

Closed
do87 opened this issue May 10, 2022 · 6 comments
Closed

unexpected Content-Type when running installer.Install #59

do87 opened this issue May 10, 2022 · 6 comments

Comments

@do87
Copy link

do87 commented May 10, 2022

i keep getting:

unexpected Content-Type: "application/vnd+hashicorp.releases-api.v0+json"

as far as i can tell this issue started about 14-15 hrs ago, everything was working fine before.

when running:

installer := &releases.ExactVersion{
	Product:    product.Terraform,
	Version:    version.Must(version.NewVersion(TFVersion)),
	InstallDir: installDir,
}
execPath, err := installer.Install(ctx)
if err != nil {
	return err
}

tried with TFVersion = 1.1.9 and 1.1.7
i also tried with:

installer := &releases.LatestVersion{
	Product:    product.Terraform,
	InstallDir: installDir,
}
execPath, err := installer.Install(ctx)
if err != nil {
	return err
}

terrafrom-exec v0.16.0 (also upgraded to v.0.16.1 and still the same error)
go v1.18

@radeksimko radeksimko transferred this issue from hashicorp/terraform-exec May 10, 2022
@radeksimko
Copy link
Member

Hi @do87
Thanks for the report and sorry for the trouble.
I believe this is a duplicate of #56 which was resolved in #57 (released earlier today as part of hc-install v0.3.2).

I noticed you filed the issue originally under terraform-exec, although that library is no longer responsible for installing Terraform. Can you clarify how do you consume hc-install? Is it a Terraform provider leveraging the plugin SDK?

If so, there's a PR currently pending review hashicorp/terraform-plugin-sdk#960 - once that is merged and released, providers should be able to continue running acceptance tests (which install Terraform using hc-install) once SDK is bumped to the latest version.

@do87
Copy link
Author

do87 commented May 10, 2022

@radeksimko sorry, i didn't notice it belonged to hc-install, which is the package i am using to run the install. i'm following the example given in terraform-exec almost exactly, and the reason for my mistake is because i mainly use the tfexec functionality.

@radeksimko
Copy link
Member

@do87 Were you able to upgrade to the latest hc-install and resolve the error?

go get github.com/hashicorp/hc-install@latest

@do87
Copy link
Author

do87 commented May 10, 2022

after updating to the latest version the install works again! thanks a lot 👍

@do87 do87 closed this as completed May 10, 2022
@yannh
Copy link

yannh commented May 11, 2022

Just to point out: requiring an upgrade will break the rebuilding of older versions of any provider. Would there be a backward compatible way of doing this change, so that older versions of providers can still be built? 🙇

@radeksimko
Copy link
Member

@yannh That sounds like a question more for https://github.com/hashicorp/terraform-plugin-sdk This is repository for hc-install, which the SDK utilizes and the latest version of this library supports both old and new header name.

I imagine one option would be getting the API to return the old header and the other would be backporting this patch somehow. I believe the older version of hc-install which the SDK uses (tfinstall) doesn't perform such strict header checking, so some older provider versions using SDK which relies on tfinstall may not have this problem.

Either way I would suggest opening an issue in the SDK repository and describe what versions of the SDK you were hoping to continue using. I can't promise anything - especially because I don't maintain the SDK - a different team does - but it is worth asking! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants