terraform-linters / tflint-ruleset-azurerm

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

Rule `azurerm_postgresql_server_invalid_version` - Incorrect postgres resource type? #249

Closed lonegunmanb closed 1 year ago

lonegunmanb commented 1 year ago

In this plugin we've restricted the server's version to:

enum: []string{
            "14",
            "13",
            "12",
            "11",
        },

In the document we described:

This rule is automatically generated from azure-rest-api-specs. If you are uncertain about the warning, check the following API schema referenced by this rule.

https://github.com/Azure/azure-rest-api-specs/tree/master/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/FlexibleServers.json

But the API referenced is about Postgres Flexible Server, which has corresponding resource: azurerm_postgresql_flexible_server.

azurerm_postgresql_server's version restriction in API spec is here, it should be:

"enum": [
        "9.5",
        "9.6",
        "10",
        "10.0",
        "10.2",
        "11"
      ],

We can verify the API version that AzureRM provider is using now here.

This resource should check azurerm_postgresql_flexible_server instead.

wata727 commented 1 year ago

Fixed by https://github.com/terraform-linters/tflint-ruleset-azurerm/pull/252