Terraform: Disable terminal colors when not an interactive terminal

Created on 12 Jun 2017  路  5Comments  路  Source: hashicorp/terraform

When terraform is run by CI, or piped to less, or otherwise run in a non-tty environment, terminal codes should be disabled for more readable output.

cli enhancement

Most helpful comment

terraform state show doesn't support -no-color either.

Would be great to be able to set TF_NO_COLOR=1 in the environment to disable all colorization completely, or something equally simple.

All 5 comments

@mcandre you can use -no-color argument. We found it very useful for our pipelines.

This should be fixed.

A simple if (isatty(STDOUT_FILENO)) nocolorarg=1;

or the equivalent for the language is all that is needed.

Some Terraform commands are missing support for -no-color, e.g. terraform providers.

terraform state show doesn't support -no-color either.

Would be great to be able to set TF_NO_COLOR=1 in the environment to disable all colorization completely, or something equally simple.

image

Really need to add no-color to every command?
And keep answering confused people you need to add the no-color parameter?

terraform, are you serious?

Was this page helpful?
0 / 5 - 0 ratings