Improve user feedback about 'bad' values of TF_CLI_CONFIG_FILE
environment variable
#32646
Labels
bug
confirmed
a Terraform Core team member has reproduced this issue
explained
a Terraform Core team member has described the root cause of this issue in code
good first issue
v1.3
Issues (primarily bugs) reported against v1.3 releases
Terraform Version
Terraform Configuration Files
Any config is relevant to this issue.
Here I've included the one I used to generate the debug output, but the config's contents are not specific to this issue.
More importantly, here's the CLI config file that I use in this issue:
Debug Output
In these examples I am trying to use a CLI configuration file to use
dev_overrides
, and I set the path to the file viaTF_CLI_CONFIG_FILE
.--
Here's what happens when I run
terraform plan
and setTF_CLI_CONFIG_FILE
to:~/
In each of the 3 examples I've truncated the logs so they finish at this log :
[INFO] backend/local: starting Plan operation
. All logs related to the CLI config are still there.Expected Behavior
I would expect Terraform to provide feedback to the user if it cannot use the path supplied via the
TF_CLI_CONFIG_FILE
environment variable - either due to it pointing at a non-existent file or unable to use for other reasons (e.g. starting with~/
).For the 3 scenarios my debug outputs above show, I would expect:
TF_CLI_CONFIG_FILE
is doing what I expect.TF_CLI_CONFIG_FILE
is not impacting the CLI configuration.~/
and behave like (1). Alternatively, it could behave like my expectations for (2) by printing a warning.Actual Behavior
TF_CLI_CONFIG_FILE
is doing what I expect.TF_CLI_CONFIG_FILE
not contributing to CLI config, and the CLI proceeds without being configuredTF_CLI_CONFIG_FILE
not contributing to CLI config, and the CLI proceeds without being configuredSteps to Reproduce
google
)terraform init
, withoutTF_CLI_CONFIG_FILE
set, to create lock file etcTF_CLI_CONFIG_FILE=<path> terraform plan
where the path value is an absolute path to the file made in step 2. You will see a warning about developer overrides in effect, and then the plan is displayed.TF_CLI_CONFIG_FILE=<path> terraform plan
where the path value is an absolute path to a file that doesn't exist. You will see no warnings about developer overrides, the command proceed with a provider downloaded from the Registry, and then the plan is displayed.TF_CLI_CONFIG_FILE=<path> terraform plan
where the path value is a path to the file made in step 2 that starts with "~/". You will see no warnings about developer overrides, the command proceed with a provider downloaded from the Registry, and then the plan is displayed.Note: if (3) isn't done then steps (5) and (6) will instead have an inconsistent dependency lock file error.
Additional Context
No other ENVs are set that impact Terraform (e.g.
TERRAFORM_CONFIG
is not being used)References
No response
The text was updated successfully, but these errors were encountered: