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

OpenTofu environment variables start with TF_, not TOFU_ #14

Open
pib opened this issue Feb 20, 2025 · 2 comments
Open

OpenTofu environment variables start with TF_, not TOFU_ #14

pib opened this issue Feb 20, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@pib
Copy link

pib commented Feb 20, 2025

What happened?

The OpenTofu provider fails to load a provided .tofurc config file, and so it fails to authenticate against a private Terraform module repository.

Upon investigation I see that the provider seems to be setting TOFU_CLI_CONFIG_FILE=./.tofurc (https://github.com/upbound/provider-opentofu/blob/main/internal/opentofu/opentofu.go#L187), but according to the OpenTofu docs, it should be setting TF_CLI_CONFIG_FILE: https://opentofu.org/docs/v1.8/cli/config/environment-variables/#tf_cli_config_file

I confirmed this by running a local tofu init -from-module with both env var names, and only the TF_ one works.

It looks like this would also mean that the plugin cache dir setting will also not function as expected, but I haven't tested that: https://github.com/upbound/provider-opentofu/blob/main/internal/opentofu/opentofu.go#L180

How can we reproduce it?

What environment did it happen in?

I'm using v0.2.1, but it looks like any version would have the same issue.

@pib pib added the bug Something isn't working label Feb 20, 2025
@pib
Copy link
Author

pib commented Feb 20, 2025

I have verified that switching to TF_CLI_CONFIG_FILE fixes the issue. I built and pushed to a private repo a fixed provider version, and after switching to that version, the issue was fixed.

@jeanduplessis
Copy link
Contributor

@pib thanks for identifying the problem and fix. Would you be willing to open a PR to fix this bug in the repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants