Skip to content

Fix error when multiple -no-color arguments are used#25847

Merged
alisdair merged 1 commit intohashicorp:masterfrom
zachwhaley:fix-tf-cli-args-no-color
Aug 24, 2020
Merged

Fix error when multiple -no-color arguments are used#25847
alisdair merged 1 commit intohashicorp:masterfrom
zachwhaley:fix-tf-cli-args-no-color

Conversation

@zachwhaley
Copy link
Copy Markdown
Contributor

Since -no-color is a global argument and not actually handled by terraform commands, it must be removed from the list of arguments sent to commands. However the current code assumes only a single -no-color argument is ever added. This can easily not be the case if someone has TF_CLI_ARGS set to include -no-color, e.g. in an automation system where color is not helpful, and a call to terraform also includes a -no-color argument.

This change removes all instances of -no-color from the argument list before sending it to the commands.

Fixes #25845

@hashicorp-cla
Copy link
Copy Markdown

hashicorp-cla commented Aug 13, 2020

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 13, 2020

Codecov Report

Merging #25847 into master will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted Files Coverage Δ
command/meta.go 68.34% <100.00%> (+0.44%) ⬆️
terraform/node_resource_plan.go 91.80% <0.00%> (-1.64%) ⬇️

Copy link
Copy Markdown
Contributor

@alisdair alisdair left a comment

Choose a reason for hiding this comment

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

This looks like a good fix to me, thank you! 👏

Are you able to sign the CLA?

@zachwhaley
Copy link
Copy Markdown
Contributor Author

Are you able to sign the CLA?

I'm almost certain. Just getting advice from my company.

@zachwhaley
Copy link
Copy Markdown
Contributor Author

BTW, still here and still working to get that CLA signed. Thanks for the patience 😊

@zachwhaley zachwhaley requested a review from alisdair August 22, 2020 00:26
Copy link
Copy Markdown
Contributor

@alisdair alisdair left a comment

Choose a reason for hiding this comment

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

Thank you! 🎉

@alisdair alisdair merged commit 3512571 into hashicorp:master Aug 24, 2020
@zachwhaley zachwhaley deleted the fix-tf-cli-args-no-color branch August 24, 2020 16:06
@ghost
Copy link
Copy Markdown

ghost commented Oct 11, 2020

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 as resolved and limited conversation to collaborators Oct 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terraform cannot handle a CLI option on the command line and in TF_CLI_ARGS

3 participants