Skip to content

use opentofu over terraform#69

Open
KiaraGrouwstra wants to merge 3 commits intonickel-lang:mainfrom
KiaraGrouwstra:opentofu
Open

use opentofu over terraform#69
KiaraGrouwstra wants to merge 3 commits intonickel-lang:mainfrom
KiaraGrouwstra:opentofu

Conversation

@KiaraGrouwstra
Copy link
Copy Markdown
Contributor

this PR replaces the use of terraform with the open-source fork opentofu, as suggested at #60.

it may be possible to refactor this to take out the ugly patch for the registry (may involve a change over at nixpkgs), but for now i wanted to focus on gathering feedback on the idea first.

while this implementation flat-out replaces the package, i actually hoped to maybe let the user choose, but came up blank with an elegant way to handle that kind of conditional here.

Copy link
Copy Markdown
Collaborator

@yannham yannham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool to see support for OpenTofu! We should probably propose both terraform and opentofu in the output indeed.

To do so we'll have to pull anything that depends on either terraform in their own definition if not already the case (e.g. mkDevShell, while generateJsonSchema or terraformProviders are already in a let-binding), then make them functions taking a terraform package as an argument so that we can pass either opentofu or terraform, instead of relying on pkgs or the ambiant self.terraform.

Since flake outputs are notoriously not parametrizable, it's reasonable to duplicate each output that depends on terraform as a -terraform version and an -opentofu version.

Would that make sense somehow?

Comment thread flake.nix Outdated
@KiaraGrouwstra
Copy link
Copy Markdown
Contributor Author

@yannham thanks, that makes sense!
i now pushed commits to:

on merge of #68 i'll rebase on that as well.

Copy link
Copy Markdown
Collaborator

@yannham yannham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good overall, beside a few details. I understand that you would like to get #68 merged first, and then rebase? Note that the CI is failing on the later PR.

Comment thread flake.nix Outdated
Comment thread flake.nix
Comment thread flake.nix
@KiaraGrouwstra
Copy link
Copy Markdown
Contributor Author

@yannham:

Thanks, looks good overall, beside a few details. I understand that you would like to get #68 merged first, and then rebase? Note that the CI is failing on the later PR.

Thanks for your feedback!

On the CI, I seem able to reproduce the failure using main branch - this regression seems induced probably by a new nixos-unstable rather than by my PRs.

@KiaraGrouwstra
Copy link
Copy Markdown
Contributor Author

hm, looks like a few dependencies cause the check to fail when updated - see #73, #74.

@KiaraGrouwstra KiaraGrouwstra mentioned this pull request Jan 11, 2025
@KiaraGrouwstra KiaraGrouwstra force-pushed the opentofu branch 2 times, most recently from 71a6cbc to 669c163 Compare January 17, 2025 12:44
@KiaraGrouwstra
Copy link
Copy Markdown
Contributor Author

rebased now

@yannham
Copy link
Copy Markdown
Collaborator

yannham commented Jan 17, 2025

It just needs a nixpkgs-fmt flake.nix; we check formatting as part of the CI.

@KiaraGrouwstra
Copy link
Copy Markdown
Contributor Author

thanks, done!

@btlogy
Copy link
Copy Markdown

btlogy commented Feb 6, 2025

Any idea why those CI checks are failing now?
Is it a failure to build only the age provider?

@yannham
Copy link
Copy Markdown
Collaborator

yannham commented Feb 6, 2025

Is it a failure to build only the age provider?

It seems so. I wonder if that could be related to NixOS/nixpkgs#376262, which followed @KiaraGrouwstra PR to Nixpkgs. And it turns out the age provider is indeed missing a homepage attribute in its manifest (it's very minimal). So, it might be worth trying to update the flake.lock and to see if that fixes the issue.

@KiaraGrouwstra
Copy link
Copy Markdown
Contributor Author

it seems i broke the check using NixOS/nixpkgs@ffacb08.
i think just reverting that would instead break the providers at run-time again tho, so trying to figure out how to make it work again now.

@GTrunSec
Copy link
Copy Markdown

@KiaraGrouwstra this is my fixed version: tao3k/omnibus@b16e2e1#diff-80903bc971e622f2452c1ab586eb74110575ac7d785224fb596d0c0706f88fefR19

make sure the required_providers { "${name}" = provider; }; change to registry.opentofu.org/xxx as well.

@KiaraGrouwstra
Copy link
Copy Markdown
Contributor Author

@GTrunSec hm, all those manual overrides were sort of what i'd intended to address :(

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.

5 participants