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

TF_CLI_ARGS errors when CLI command args: []string{"output", "-input=false", "whatever"} #17094

Closed
nik-shornikov opened this issue Jan 12, 2018 · 4 comments
Labels

Comments

@nik-shornikov
Copy link

Using Terraform in a CI environment, we set TF_CLI_ARGS: "-input=false". However, subcommands are inconsistent on the flags they accept. The output subcommand produces:

flag provided but not defined: -input

I understand the desire to have environment variable flags exist "upstream", but having ambient conditions result in command help on STDERR for a well-formed command is too opaque.

@nik-shornikov nik-shornikov changed the title TF_CLI_ARGS produces CLI command args: []string{"output", "-input=false", "whatever"} TF_CLI_ARGS errors when CLI command args: []string{"output", "-input=false", "whatever"} Jan 12, 2018
@apparentlymart
Copy link
Contributor

Hi @nik-shornikov,

In general I'd recommend using this environment variable functionality only in very specific situations, such as when running Terraform in automation. As you noted, it can be very confusing if you have variables set in your shell without knowing. This mechanism was added to allow for some unusual use-cases without having to implement a separate environment variable for every possible CLI option.

With that said, this mechanism does allow setting commands on a subcommand-specific basis using names of the form TF_CLI_ARGS_plan which, for example, adds arguments that apply only to the plan subcommand.

@lexrj
Copy link

lexrj commented Jun 6, 2019

I also encountered this, though the output in Terraform 0.12.0 did not indicate at first that I had provided an unknown flag. I am using the environment variable for automation purposes, but didn't know about the ability to specify per command, which I will now use.

@mildwonkey
Copy link
Contributor

Hi folks! The error message has been improved in this situation, and martin provided a solution for per-command variable, so I am going to close this issue. Thanks!

@ghost
Copy link

ghost commented Sep 28, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Sep 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants