Closed lonegunmanb closed 1 year ago
A minimum example to reproduce this issue:
variable "storage_container" {
type = list(string)
default = []
}
variable "new_private_endpoint" {
type = string
default = null
}
variable "storage_queue" {
type = list(string)
default = []
}
variable "storage_table" {
type = list(string)
default = []
}
variable "storage_account" {
type = object({
access_tier = optional(string)
account_kind = optional(string)
account_replication_type = string
account_tier = string
location = string
name = string
resource_group_name = string
})
description = ""
nullable = false
}
locals {
blob_endpoint = length(var.storage_container) == 0 ? [] : ["blob"]
endpoints = toset(concat(local.blob_endpoint, local.queue_endpoint, local.table_endpoint))
private_endpoint_enabled = var.new_private_endpoint != null
private_endpoints = local.private_endpoint_enabled ? local.endpoints : toset({})
queue_endpoint = length(var.storage_queue) == 0 ? [] : ["queue"]
table_endpoint = length(var.storage_table) == 0 ? [] : ["table"]
}
resource "azurerm_storage_account" "this" {
for_each = local.private_endpoints
account_replication_type = var.storage_account.account_replication_type
account_tier = var.storage_account.account_tier
location = var.storage_account.location
name = var.storage_account.name
resource_group_name = var.storage_account.resource_group_name
access_tier = var.storage_account.access_tier
account_kind = var.storage_account.account_kind
}
I think I've figured out the error... Incorrect type conversion, apology for the false alarm...
I was using tflint azurerm plugin to check the following code:
And I got the following error:
I was using the latest tag version:
The same error occured when I skipped this rule for
azurerm_storage_account_invalid_resource_group_name
andazurerm_storage_account_invalid_account_kind
, I guess there're more rules like this one.