Closed suzuki-shunsuke closed 2 years ago
It is difficult to debug because I don't know how to output the plugin log.
You can use a custom logger for debugging. https://pkg.go.dev/github.com/terraform-linters/tflint-plugin-sdk@v0.10.1/logger
Logs via this logger are forwarded to TFLint. Depending on the log level, you can filter by TFLINT_LOG
.
Oh, I see. Thank you. I can see the log.
Problem
Terraform supports defining multiple configurations for the same provider, and select which one to use on a per-resource or per-module basis.
https://www.terraform.io/language/providers/configuration#alias-multiple-provider-configurations
But tflint doesn't support this, so even if multiple configurations are defined only one configuration is used. This raises a problem in Deep Checking.
How to reproduce
.tflint.hcl
main.tf
This error occurs even if Key Pair and AMI exist in the region
ap-northeast-1
, because tflint gets resources fromus-east-1
using the aliasus-east-1
.Solution
Runner.AwsClient
to mapmap[string]*Client
and creates clients per Provider Configurationprovider
attribute and get the appropriate Client from map of clientsI tried to implement this, but it doesn't work well yet.
https://github.com/terraform-linters/tflint-ruleset-aws/pull/332
I'll appreciate if you help me. It is difficult to debug because I don't know how to output the plugin log.
Reference