Terraform-provider-azurerm: The provider doesn't support the resource azurerm_postgresql_virtual_network_rule

Created on 21 Sep 2018  ·  6Comments  ·  Source: terraform-providers/terraform-provider-azurerm

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

AzureRm : 0.11.8
Terraform : 1.8

Affected Resource(s)

  • azurerm_postgresql_virtual_network_rule

Actual Behavior

Error saying that the provider doesn't support the resource azurerm_postgresql_virtual_network_rule

Steps to Reproduce

#Set the Provider
provider "azurerm" {
    subscription_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    client_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    client_secret = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    tenant_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

variable "postgresql_server"{
  type = "map"

  default = {
    suffix_name            = "demopg"
    administrator_login    = "psqladminun"
    administrator_password = "H@Sh1CoR3!"
    version                = "9.5"
    ssl_enforcement        = "Enabled"
    sku_name               = "B_Gen4_2"
    sku_capacity           = 2
    sku_tier               = "Basic"
    sku_family             = "Gen4"
    config_value           = "on"
    storage_mb             = 5120
    backup_retention_days  = 7
    geo_redundant_backup   = "Disabled"
  }
}

variable "pgsql_config" {
  type = "map"

  default = {
    id_server = "0"  #Must match an Id of one postgresql_server
    value     = "on"
  }
}

variable "pgsql_db_firewall" {
  type = "map"

  default = {
    id_server = "0" #Must match an Id of one postgresql_server
    id        = "1" #Id of the postgre sql database
    start_ip  = "192.168.1.10"
    end_ip    = "192.168.1.19"
  }
}

variable "pgsql_db" {
  type = "map"

  default = {
    id_server   = "0"                          #Must match an Id of one postgresql_server
    id          = "1"                          #Id of the postgre sql database
    suffix_name = "demopg"
    charset     = "UTF8"
    collation   = "English_United States.1252"
  }
}

variable "pgsql_location" {
  default = "northeurope"
}

variable "pgsql_rg" {
  default = "MyRg"
}

module "Create-AzureRmPostgreSqlDatabase-Apps" {
  source                  = "github.com/JamesDLD/terraform/module/Create-AzureRmPostgreSqlDatabase"
  version                       = "c312252"
  pgsql_prefix              = "myapp"
  pgsql_suffix              = "-pgsql1"
  pgsql_server              = ["${var.pgsql_server}"]
  pgsql_administrator_login    = "admindemo"
  pgsql_administrator_password = "Password123"
  pgsql_config              = ["${var.pgsql_config}"]
  pgsql_db_firewall         = ["${var.pgsql_db_firewall}"]
  pgsql_db                  = ["${var.pgsql_db}"]
  pgsql_resource_group_name = "MyRgName"
  pgsql_location            = "northeurope"
  pgsql_subnet_id           = "/subscriptions/xxxxxxxxx/resourceGroups/MyRgName/providers/Microsoft.Network/virtualNetworks/MyVnetName/subnets/MySubnetName""
}

Important Factoids

References

question

Most helpful comment

@JamesDLD yes - that’ll be because of the tier - Virtual Network Rules aren’t supported on the Basic tier (and return this unhelpful error message) - we should add some better validation for that, actually 🤔

All 6 comments

I assume that the Terraform versions that you provided got mixed up, and that you are using Terraform 0.11.8 with AzureRM provider 1.8?

The changelog states that the azurerm_postgresql_virtual_network_rule resource is supported since version 1.14 of the AzureRM provider. Can you try updating your AzureRM provider to version 1.14 or higher?

hey @JamesDLD

Thanks for opening this issue :)

As @robinkb has mentioned - the AzureRM Provider only supported this resource from v1.14.0 of the Provider, since you're using v1.8 this isn't available and you'd need to upgrade to a newer version to be able to use this resource. You should be able to upgrade to the latest version by updating your Provider block:

provider "azurerm" {
 version = "=1.15.0"
}

and then running terraform init -upgrade - would you be able to take a look and see if that works for you? Since this is a question about how to use the Provider rather than a bug in Terraform - I'm going to close this issue for the moment (but we'll keep responding 😄)

Thanks!

Indeed got mixed up, I am now using AzureRm version 1.15 and the resource is well known.
Thank you for that.

I just got the following error message, does this speak to you?

Error: Error applying plan:

1 error(s) occurred:

* module.Create-AzureRmPostgreSqlDatabase-Apps.azurerm_postgresql_virtual_network_rule.vnet_rules: 1 error(s) occurred:

* azurerm_postgresql_virtual_network_rule.vnet_rules: Error waiting for PostgreSQL Virtual Network Rule "demo-dev-demopg-pgsql1-vnetrule" (PostgreSQL Server: "demo-dev-demopg-pgsql1", Resource Group: "dev-prd-rg") to be created or updated: timeout while waiting for state to become 'Ready' (last state: 'ResponseNotFound', timeout: 10m0s)

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

@JamesDLD yes - that’ll be because of the tier - Virtual Network Rules aren’t supported on the Basic tier (and return this unhelpful error message) - we should add some better validation for that, actually 🤔

Thanks @tombuildsstuff you are always there 👍
May i suggest an improvement : would be great when changing the PostgreSql Edition to delete and re create the PostgreSql server, I tried to do it and receive the following message.
Thanks for all the work done here between Azure and Hashicorp.

Error: Error applying plan:

1 error(s) occurred:

* module.Create-AzureRmPostgreSqlDatabase-Apps.azurerm_postgresql_server.pgsql_server: 1 error(s) occurred:

* azurerm_postgresql_server.pgsql_server: Error waiting for update of PostgreSQL Server "demo-dev-pgsql1" (Resource Group "my-dev-rg"): Code="InvalidUpgradeEdition" Message="The edition 'GeneralPurpose' is not a valid edition. Edition cannot be changed by update."

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

Was this page helpful?
0 / 5 - 0 ratings