Terraform using wrong version of provider

Viewed 995

I'm trying to create a Postgres server on Azure using the azurerm_postgresql_server resource block. I've got the azurerm version pinned to 2.4.0 which means I should be up to date and can use the examples from the documentation. Instead, I'm getting missing required argument errors and seeing messages refer to missing attributes, that according to the documentation are deprecated.

So far I've tried running terraform init -upgrade in case I had previously tried a Postgres creation with an older version of the provider and it caused a cached version of the plugin but it's not had any effect. I have no idea what's wrong - if it's the code itself or the terraform setup on my machine. Simplified code snippet and error output are below, thanks!

provider "azurerm" {
  version           = "=2.4.0"
  subscription_id   = "xxxxxxxxxxxxxxx"

  features {
    key_vault {
      purge_soft_delete_on_destroy = true
    }
  }
}

resource "azurerm_postgresql_server" "postgres" {
  name                         = "sarum-hymnal-postgresql-server"
  location                     = var.resource_group.location
  resource_group_name          = var.resource_group.name
  sku_name                     = "B_Gen4_1"
  storage_mb                   = 5120
  backup_retention_days        = 7
  geo_redundant_backup_enabled = false
  auto_grow_enabled            = false
  administrator_login          = data.azurerm_key_vault_secret.POSTGRES-USERNAME.value
  administrator_login_password = data.azurerm_key_vault_secret.POSTGRES-SECRET.value
  version                      = "11"
  ssl_enforcement_enabled      = true
  tags                         = var.resource_group.tags
}
Error: Missing required argument

  on sarum-hymnal/main.tf line 26, in resource "azurerm_postgresql_server" "postgres":
  26: resource "azurerm_postgresql_server" "postgres" {

The argument "ssl_enforcement" is required, but no definition was found.


Error: Unsupported argument

  on sarum-hymnal/main.tf line 31, in resource "azurerm_postgresql_server" "postgres":
  31:   storage_mb                   = 5120

An argument named "storage_mb" is not expected here.

by running terraform providers at the root directory I get the following output:

 .
 ├── provider.azurerm =2.4.0
 ├── module.early-modern-ballot
 │   └── provider.azurerm (inherited)
 ├── module.hands-on-reading
 │   └── provider.azurerm (inherited)
 ├── module.poetic-transformations
 │   └── provider.azurerm (inherited)
 ├── module.sarum-hymnal
 │   └── provider.azurerm (inherited)
 ├── module.soundscapes-of-text
 │   └── provider.azurerm (inherited)
 └── module.translations
     └── provider.azurerm (inherited)
1 Answers
Related