Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix log level #12093

Open
jimsnab opened this issue Jul 14, 2022 · 2 comments
Open

Fix log level #12093

jimsnab opened this issue Jul 14, 2022 · 2 comments

Comments

@jimsnab
Copy link

jimsnab commented Jul 14, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v1.2.5
on linux_amd64

Affected Resource(s)

  • google_*

Debug Output

The provider is using Terraform suggestion to print the log level in a log message, but Terraform has a bug where it captures the provider's output and prints it as [INFO]. Note the [INFO] and [DEBUG] on the same line. Hashicorp says they won't fix this.

Instead, they've provided their own logging API that the provider can use, which includes the log level as an explicit parameter. See tflog.

Actual Behavior

Example of Google Provider log output:

2022-07-14T10:26:03.548-0400 [INFO]  provider.terraform-provider-google_v4.28.0_x5: 2022/07/14 10:26:03 [DEBUG] Retry Transport: starting RoundTrip retry loop: timestamp=2022-07-14T10:26:03.548-0400
2022-07-14T10:26:03.548-0400 [INFO]  provider.terraform-provider-google_v4.28.0_x5: 2022/07/14 10:26:03 [DEBUG] Retry Transport: request attempt 0: timestamp=2022-07-14T10:26:03.548-0400
2022-07-14T10:26:03.889-0400 [INFO]  provider.terraform-provider-google_v4.28.0_x5: 2022/07/14 10:26:03 [DEBUG] Retry Transport: Stopping retries, last request was successful: timestamp=2022-07-14

Thus the provider's logging is very noisy.

Steps to Reproduce

  1. Turn on logging, e.g., export TF_LOG=info
  2. terraform apply in a project of your choosing that uses the google provider
  3. Expect only INFO and higher, but actually get DEBUG (and TRACE, if the provider uses it)
@jimsnab jimsnab added the bug label Jul 14, 2022
@edwardmedia edwardmedia self-assigned this Jul 14, 2022
@edwardmedia
Copy link
Contributor

edwardmedia commented Jul 14, 2022

@jimsnab this is controlled by Terraform Core. Do you want to file an issue over there instead?

@jimsnab
Copy link
Author

jimsnab commented Jul 14, 2022

Using log.*() yes it is Terraform Core where it is already known and won't fix.

The Google provider can be changed to use the tflog api instead and solve the issue.

@edwardmedia edwardmedia removed their assignment Jul 14, 2022
@rileykarson rileykarson added this to the Near-Term Goals milestone Jul 18, 2022
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this issue Oct 23, 2024
[upstream:db2e60d6251d68d9cd98621e686c99078903cd24]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit that referenced this issue Oct 23, 2024
[upstream:db2e60d6251d68d9cd98621e686c99078903cd24]

Signed-off-by: Modular Magician <magic-modules@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants