hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io
Other
43.15k stars 9.58k forks source link

Hide refresh logs and no change logs #20960

Open rverma-nikiai opened 5 years ago

rverma-nikiai commented 5 years ago

Current Terraform Version

0.12.2

Use-cases

Option to make logs lesser verbose for terraform init,terraform plan and terraform apply steps for CI systems by hiding refresh step details as well as a message like

This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed.

and

Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "aws" (2.5.0)...
- Downloading plugin for provider "null" (2.1.0)...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.aws: version = "~> 2.5"
* provider.null: version = "~> 2.1"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

For No changes only message as No changes. Infrastructure is up-to-date. should be sufficient.

This would be more helpful with very large terraform projects with an automation step to drill down the changes faster and generating lesser logs.

Our current setup had around 70+ terraform modules and the log generated on each sync is over 3000 lines when there are no changes.

rverma-nikiai commented 5 years ago

Even better is go 1 step ahead and hide No changes. Infrastructure is up-to-date logs as well.

tdmalone commented 5 years ago

@rverma-nikiai As a workaround, you could post-process your CI logs and / or run Terraform in CI via a wrapper script and hide certain log messages?

aaleksandrov commented 5 years ago

We'd like this feature as well. We are integrating Teffaform with Atlantis. Atlantis posts 15 comments to Github PR with all these useless information