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

Fix evaluation with OpenTofu in nixpkgs #78

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Lillecarl
Copy link
Contributor

@Lillecarl Lillecarl commented Jan 17, 2025

Allow extra arguments to mkTerraformProvider since OpenTofus withPlugins function overrides provider-source-address to set provider registry to registry.opentofu.org rather than registry.terrraform.io.

Not sure exactly how and when it worked before. This silently ignores any extra arguments.

Fixes this eval error:

error:
       … while evaluating 'strict' to select 'drvPath' on it
         at /builtin/derivation.nix:1:552:
       … while calling the 'derivationStrict' builtin
         at /builtin/derivation.nix:1:208:
       (stack trace truncated; use '--show-trace' to show the full trace)

       error: function 'anonymous lambda' called with unexpected argument 'provider-source-address'
       at /nix/store/3qfsm6xi1p7gghms7kjfdqzffxg41d5w-source/default.nix:22:5:
           21|   mkTerraformProvider = lib.makeOverridable (
           22|     { owner
             |     ^
           23|     , repo

See https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/op/opentofu/package.nix#L117

TODO: Support provider-source-address so this repo doesn't require you to override registry manually. (Or improve docs regarding the differenences)

Lillecarl and others added 2 commits January 17, 2025 15:54
Allow extra arguments to mkTerraformProvider since OpenTofus withPlugins
function overrides provider-source-address to set provider registry to
registry.opentofu.org rather than registry.terrraform.io.
@zimbatm
Copy link
Member

zimbatm commented Jan 17, 2025

@Lillecarl would the change I pushed make sense? I'd like to avoid opening the interface without bounds

@Lillecarl
Copy link
Contributor Author

In the let block we set provider-source-address which shadows the provider-source-address from the arglist.

, provider-source-address ? null

would make more sense tbh.

Since we don't set provider-source-address on our providers the OpenTofu withPlugins override is unclear.

I think the way they implemented that in nixpkgs is a bit clumsy, i'd prefer it if they only override an arg if it already exists.

@zimbatm
Copy link
Member

zimbatm commented Jan 18, 2025

Ok let's fix this in nixpkgs then. Do you have a working example I can use?

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

Successfully merging this pull request may close these issues.

2 participants