hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.59k stars 4.63k forks source link

azurerm_postgresql_database doesn't take over charset #18088

Closed julbrunner closed 2 years ago

julbrunner commented 2 years ago

Is there an existing issue for this?

Community Note

Terraform Version

1.2.2

AzureRM Provider Version

3.19.1

Affected Resource(s)/Data Source(s)

azurerm_postgresql_database

Terraform Configuration Files

# Register the needed azure resource manager provider from Terraform
terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "~> 3.4"
    }
  }
}

# Configure azure provider
provider "azurerm" {
  skip_provider_registration = true # needs to be set due to permission level
  features {
  }
}

data "azurerm_resource_group" "test_rg" {
  name = "test"
}

resource "random_id" "rnd_id" {
    byte_length = 8
}

resource "random_password" "password" {
  length           = 16
  special          = true
  override_special = "!#$%&*()-_=+[]{}<>:?"
}

resource "azurerm_postgresql_server" "test" {
  name                = "postgresqlserver${lower(random_id.rnd_id.hex)}"
  location            = data.azurerm_resource_group.test_rg.location
  resource_group_name = data.azurerm_resource_group.test_rg.name

  administrator_login          = "admin${lower(random_id.rnd_id.hex)}"
  administrator_login_password = random_password.password.result

  sku_name   = "GP_Gen5_2"
  version    = "11"
  storage_mb = 5120

  backup_retention_days        = 30
  geo_redundant_backup_enabled = false
  auto_grow_enabled            = false

  public_network_access_enabled    = false
  ssl_enforcement_enabled          = true
  ssl_minimal_tls_version_enforced = "TLS1_2"
}

resource "azurerm_postgresql_database" "testSQLdb" {
  name                = "testdb${lower(random_id.rnd_id.hex)}"
  resource_group_name = data.azurerm_resource_group.test_rg.name
  server_name         = azurerm_postgresql_server.test.name
  charset             = "utf8"
  collation           = "English_United States.1252"
}

Debug Output/Panic Output

none

Expected Behaviour

When accessing postgre SQL i would expect that in menu "server parameters" the enconding would've been changed to "UTF8".

Actual Behaviour

Charset remains on SQL_ASCII

Steps to Reproduce

No response

Important Factoids

No response

References

No response

neil-yechenwei commented 2 years ago

@julbrunner , thanks for raising this issue. I assume you're asking how to set the sever parameters in postgresql. If yes, I assume you should use azurerm_postgresql_server to implement it.

Example:

resource "azurerm_postgresql_configuration" "test" {
  name                = "client_encoding"
  resource_group_name = azurerm_postgresql_server.test.resource_group_name
  server_name         = azurerm_postgresql_server.test.name
  value               = "UTF8"
}
julbrunner commented 2 years ago

@neil-yechenwei thanks, that did the trick ;)

github-actions[bot] commented 2 years ago

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.