-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Terraform validate try to execute provider_name.zip #32434
Comments
Hi @grimlokason! Thanks for reporting this. Terraform's current behavior is to search each file in the root of the provider's distribution package until it finds one that has the prefix Terraform behaves this way because historically (before we formalized the plugin packaging format and the registry protocol) provider developers used a variety of different naming schemes and so this prefix-matching approach covers all of the various different naming schemes that older provider packages used, and so allows modern Terraform to still work with some older provider packages. In your case it seems like for some reason your provider package directory contained the package itself. I'm guessing that's because you manually constructed a local mirror directory for your custom provider and did so by first downloading the zip file and then extracting it. Something like this:
This then caused your mirror directory to contain incorrect package contents for this provider, because you still had the
If you are careful to make sure that your mirror really is a true mirror of the upstream package -- without any extra files like this one -- then Terraform should be able to use it correctly. The other thing I'd note is that if you are just mirroring the upstream provider
If you do that then you'll be able to use the provider's typical source address We could consider adding a special case to the logic which tries to find the provider executable to not consider any file whose suffix is I think it would be better to keep this as an error but add an extra hint to the error message if the selected plugin file has a "Did you forget to clean up the provider's distribution archive after manually extracting it? The provider package directory must exactly match the contents of the archive, with no additional files." This would then hopefully hint at the correct solution and help ensure that you have a correct mirror, which will then avoid recording incorrect checksums in the dependency lock file that are likely to cause problems when trying to use the same configuration on a different computer later. |
Terraform Version
Terraform Configuration Files
Debug Output
NB : this contains the workaround used to bypass the issue.
https://gist.github.com/grimlokason/7010c546e9084270d6c47b614dd11663
Expected Behavior
terraform validate
should not try to use the terraform-provider-flexibleengine_1.35.1_linux_amd64.zip but terraform-provider-flexibleengine_v1.35.1Actual Behavior
terraform validate
crash because it try to execute a zip file instead of a go file with that error :Steps to Reproduce
The text was updated successfully, but these errors were encountered: