Terraform: feature request: add quiet flag to init command

Created on 16 Jul 2018  路  3Comments  路  Source: hashicorp/terraform

When using TF in automation, It will be useful if you could add a --quiet option for the init command.
currently the verbosity of this command is less relevant when running TF in our CI server IMHO.

for example, I'd be happy to get rid of the following output for the init command -
```

Initializing modules...

  • module.get_base_ami
  • module.worker_d_spotinst_group
  • module.worker_m_spotinst_group
  • module.worker_s_spotinst_group
  • module.worker_i_spotinst_group
  • module.worker_g_spotinst_group
  • module.mng_spotinst_group
  • module.core-op_spotinst_group
  • module.core-sc_spotinst_group
  • module.core-vr_spotinst_group
  • module.worker_d_spotinst_group.get_role_group_config
  • module.worker_m_spotinst_group.get_role_group_config
  • module.worker_s_spotinst_group.get_role_group_config
  • module.worker_g_spotinst_group.get_role_group_config
  • module.core-op_spotinst_group.get_role_group_config
  • module.core-sc_spotinst_group.get_role_group_config
  • module.worker_i_spotinst_group.get_role_group_config
  • module.mng_spotinst_group.get_role_group_config
  • module.core-vr_spotinst_group.get_role_group_config

Initializing the backend...

Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...

````

cli enhancement

Most helpful comment

Hi @giladsh1!

Is your expectation that --quiet would silence the output completely unless there is an error, or are there some parts of the output that you still want to see?

For the short term I might suggest redirecting the stdout of this command to null (on a unix system, e.g. terraform init >/dev/null) which should still show any errors since they will be printed to stderr.

In the short term we are generally leaning towards minimizing the number of available options on most commands in order to keep things easy to maintain and test, but once work on the lower levels of Terraform (the configuration, provider APIs, etc) is stabilized in a few releases we're likely to be more open to carefully introducing some additional cases in the test matrix.

All 3 comments

Hi @giladsh1!

Is your expectation that --quiet would silence the output completely unless there is an error, or are there some parts of the output that you still want to see?

For the short term I might suggest redirecting the stdout of this command to null (on a unix system, e.g. terraform init >/dev/null) which should still show any errors since they will be printed to stderr.

In the short term we are generally leaning towards minimizing the number of available options on most commands in order to keep things easy to maintain and test, but once work on the lower levels of Terraform (the configuration, provider APIs, etc) is stabilized in a few releases we're likely to be more open to carefully introducing some additional cases in the test matrix.

fwiw, setting the environment variable TF_IN_AUTOMATION will make terraform init (and some other commands) a little quieter:

$ TF_IN_AUTOMATION=true terraform init
Initializing modules...
- module.test_image_0_0_1
- module.test_image_0_0_2
- module.test1_eks
- module.test2_eks
- module.ingress_controller_policy
- module.worker_nodes_instance_role

Initializing the backend...

Initializing provider plugins...

Terraform has been successfully initialized!

It still shows the list of modules, but it does cut down any of the instructions usually shown at the end of the above output.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

franklinwise picture franklinwise  路  3Comments

ronnix picture ronnix  路  3Comments

rjinski picture rjinski  路  3Comments

shanmugakarna picture shanmugakarna  路  3Comments

pawelsawicz picture pawelsawicz  路  3Comments