Open smokestacklightnin opened 1 month ago
This is what you can use to detect which registry you're using:
https://noxon.cc/@jeff/112157251058272180
So taking that idea, a way to go about this is to look at the presence of registry.opentofu.org
in .terraform.lock.hcl
.
If OpenTofu's registry is used, use the tofu
executable, otherwise, use terraform
.
@dotemacs Can't you use one registry with the other binary? If this is 100% reliable then we can do that indeed, otherwise a config variable (which you can also set in directory local setup then to override for specific repository) would be a better option.
@dotemacs Can't you use one registry with the other binary?
What exactly do you mean by this @Fuco1?
Do you mean can OpenTofu registry be used with Terraform? And vice versa?
If this is 100% reliable then we can do that indeed,
I saw the above quoted answer on Mastodon and then saw the same toot shared by the OpenTofu core developers, when other people asked about it on OpenTofu Slack. I'm basing my perception of reliability solely on that.
otherwise a config variable (which you can also set in directory local setup then to override for specific repository) would be a better option.
I'd say, that having both would be a good thing.
terraform-mode
currently necessarily calls theterraform
binary when formatting buffers or regionsWould it please be possible to add the option to call the OpenTofu
tofu
command for fomatting instead ofterraform
for those of us with only OpenTofu installed?I expect this is as simple as creating a configurable variable. I'd open a PR myself, but I'm not familiar enough with Lisp to do this quickly.