Loading...
Loading...
### Terraform Version ```shell Terraform v1.13.0 on darwin_arm64 ``` ### Terraform Configuration Files The both provider uses `tflog` package for logging, which is required for using `TF_LOG_PROVIDER_{PROVIDER_NAME}`. ```terraform terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 6.0" } google = { source = "hashicorp/google" version = "~> 6.0" } } } provider "aws" { region = "us-west-2" } provider "google" { project = "my-gcp-project" region = "us-central1" } ``` ### Debug Output ``` % TF_LOG_PROVIDER_AWS=debug terraform plan No changes. Your infrastructure matches the configuration. Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed. ``` ### Expected Behavior Output logs from AWS Provider at the DEBUG level, and no output logs from any other providers ### Actual Behavior No logs from all providers ### Steps to Reproduce ``` % terraform init % TF_LOG_PROVIDER_AWS=debug terraform plan ``` ### Additional Context According to the documentation (https://developer.hashicorp.com/terraform/plugin/log/managing#enable-logging), we can control the log level for a specific provider by setting `TF_LOG_PROVIDER_{PROVIDER_NAME}` environment variable. For example, setting `TF_LOG_PROVIDER_AWS=trace` is expected to output AWS Provider logs at the `TRACE` level while suppressing logs from other providers. However, this simply does not work. I've tested various combinations with `TF_LOG_PROVIDER`, but `TF_LOG_PROVIDER_{PROVIDER_NAME}` appears to have no effect on log output: | TF_LOG_PROVIDER | TF_LOG_PROVIDER_XXX | Expected Provider Log Level | Actual Provider Log Level | |-----------------|---------------------|-----------------------------|---------------------------| | (not set) | DEBUG | **XXX: DEBUG**Others: OFF | ❌ **XXX: OFF** ✅ Others: OFF | | DEBUG | (not set) | XXX: DEBUGOthers: DEBUG | ✅ Works as expected | | DEBUG | INFO | **XXX: INFO**Others: DEBUG | ❌ **XXX: DEBUG**✅ Others: DEBUG | | INFO | DEBUG | **XXX: DEBUG**Others: INFO | ❌ **XXX: INFO**✅ Others: INFO | From my code investigation, Terraform Core is responsible for determining provider log levels. However, the current implementation only recognizes `TF_LOG_PROVIDER` and `TF_LOG` environment variables. It does not consider `TF_LOG_PROVIDER_{NAME}` to set log levels on a per-provider basis. ### References Original discussion: https://discuss.hashicorp.com/t/tf-log-provider-name-does-not-work/39963 ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.