terraform-linters / tflint-ruleset-azurerm

TFLint ruleset for terraform-provider-azurerm
Mozilla Public License 2.0
116 stars 24 forks source link

failed to check "azurerm_automation_account_invalid_sku_name" #312

Closed Netkracker closed 8 months ago

Netkracker commented 8 months ago

Tflint version & ruleset version: image

While running tflint over the following configuration:

" resource "azurerm_automation_account" "aa_wipe" { name = "aa-wipe-${trim(data.azurerm_subscription.current.display_name, "azc")}-${local.random}" location = azurerm_resource_group.rg.location resource_group_name = azurerm_resource_group.rg.name public_network_access_enabled = true sku_name = "Basic"

identity { type = "SystemAssigned" }

} "

it throws the error "Failed to check ruleset; failed to check "azurerm_automation_account_invalid_sku_name" rule: main_base.tf:71,11-42: Incorrect value type; Invalid expression value: number required., and 1 other diagnostic(s)"

terraform docs for the azurerm provider: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/automation_account#sku_name

Tflint docs: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/master/docs/rules/azurerm_automation_account_invalid_sku_name.md

this looks like an bug that as both documentations and the code sku_name match.

Netkracker commented 8 months ago

error is misleading had an issue with other terraform logic. changed "count = var.testing == true ? [0] : [1]" to "count = var.testing == "true" ? 0 : 1"

now the tflint error does not appear anymore.