NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.2k stars 14.2k forks source link

Terraform B2 provider is broken: malformed module path "command-line-arguments": missing dot in first path element #177432

Closed Hjdskes closed 2 years ago

Hjdskes commented 2 years ago

Describe the bug

In https://github.com/NixOS/nixpkgs/pull/173796 I added Backblaze B2's Terraform provider. When running the plugin before I ran into

│ Error: Failed to load plugin schemas
│ 
│ Error while loading schemas for plugin components: Failed to obtain provider schema: Could not load the schema for
│ provider registry.terraform.io/backblaze/b2: failed to instantiate provider "registry.terraform.io/backblaze/b2" to
│ obtain schema: Unrecognized remote plugin message: 
│ 
│ This usually means that the plugin is either invalid or simply
│ needs to be recompiled to support the latest protocol...

I have now been able to troubleshoot this and realise the plugin is currently broken. Running Terraform with TF_LOG=DEBUG, I find the culprit:

[DEBUG] provider.terraform-provider-b2_0.8.0: 2022/06/12 20:44:29 exit status 1: malformed module path "command-line-arguments": missing dot in first path element

It seems that this is some Go specific error message, related to its packaging imports. As I'm not familiar with Go, I don't know where to troubleshoot this or how to fix this in Nix. I am reporting this in the hopes that similar issues have been resolved before, or that someone familiar with Go can pinpoint the issue.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Define a minimal nix environment with Terraform and the b2 provider: pkgs.terraform.withPlugins (p: [ p.b2 ])
  2. export TF_LOG=DEBUG; terraform init && terraform plan for any plan using the b2 Terraform provider.

Expected behavior

I expect the Terraform provider to work and to provision my resources.

Notify maintainers

@zowoq

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

copying path '/nix/store/ygpifz5jrygl1qj8isnyjnc6kxsxj7m0-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 5.17.13-300.fc36.x86_64, Fedora Linux, 36 (Workstation Edition)`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.6.1`
 - channels(jente): `"nixpkgs-21.05"`
 - nixpkgs: `/home/jente/.nix-defexpr/channels/nixpkgs`
zowoq commented 2 years ago

Likely to be this:

https://github.com/Backblaze/terraform-provider-b2 The provider is written in go, but it uses official B2 python SDK embedded into the binary.

The overrides that we will need to use to build this in nixpkgs with our current provider model will be rather non-trivial and make it the most complicated provider that we package.

TBH I'd rather remove the b2 from nixpkgs and point people to nixpkgs-terraform-providers-bin as an alternative.

cc @zimbatm

zimbatm commented 2 years ago

agreed, let's remove it