Provider with alias doesn't exist error with v0.24.0
adamstirk-ct opened this issue · 3 comments
adamstirk-ct commented
With v0.24.0 of the ruleset I'm now getting the error below, even though the provider exists.
Failed to check ruleset; failed to check "aws_resource_missing_tags" rule: The aws provider with alias "us-east-1" doesn't exist.
Below is a simple example that replicates this issue
File: .tflint.hcl
plugin "terraform" {
enabled = true
preset = "all"
}
plugin "aws" {
enabled = true
deep_check = false
version = "0.24.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}
rule "aws_resource_missing_tags" {
enabled = true
tags = ["Environment"]
}
File: main.tf
provider "aws" {
region = eu-west-1
}
provider "aws" {
region = "us-east-1"
alias = "us-east-1"
}
terraform {
required_version = ">= 1.3.7"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.59"
}
}
}
resource "aws_ssm_parameter" "test1" {
name = "test1"
type = "String"
value = "test"
tags = {
Environment = "test"
}
}
resource "aws_ssm_parameter" "test2" {
name = "test2"
type = "String"
value = "test"
provider = aws.us-east-1
tags = {
Environment = "test"
}
}
File: outputs.tf
# Empty file
File: variables.tf
# Empty file
wata727 commented
@JorgeReus Can you investigate this?
JorgeReus commented
On it
JorgeReus commented
Found the issue, I ignored providers without tags, which introduced this error, this is fixed in #508, sorry!
@adamstirk-ct As a temporal workaround, you could add an empty default tags block, until the PR gets merged:
provider "aws" {
region = "us-west-1"
alias = "west"
default_tags {
tags = {}
}
}