Create a situation that will cause a provider to log an event of WARN or ERROR level
Run TF_LOG_PROVIDER=WARN TF_LOG_PATH=./tf.log terraform plan
Review tf.log, notice the events are not shown
The issue is that we are using a deprecated logging pattern, and terraform encourages the use of their tflog package instead.
Expected Behavior
The log level specified by the provider should be understood correctly by terraform so filtering by log level works, and the user is not presenting with conflicting log levels.
Actual Behavior
We log all events as INFO level, while specifying our actual level as a string in the log message.
Steps to Reproduce
Look at any logged event from the provider
See the log level is INFO, regardless of what the provider specified using the log package, followed by the actual log level presented as a string at the beginning of the log message.
Terraform Version
terraform 1.5.7
Affected Resource(s)
Most or all
Repro Steps
TF_LOG_PROVIDER=WARN TF_LOG_PATH=./tf.log terraform plan
tf.log
, notice the events are not shownThe issue is that we are using a deprecated logging pattern, and terraform encourages the use of their
tflog
package instead.Expected Behavior
The log level specified by the provider should be understood correctly by terraform so filtering by log level works, and the user is not presenting with conflicting log levels.
Actual Behavior
We log all events as
INFO
level, while specifying our actual level as a string in the log message.Steps to Reproduce
INFO
, regardless of what the provider specified using thelog
package, followed by the actual log level presented as a string at the beginning of the log message.References
https://developer.hashicorp.com/terraform/plugin/log/writing