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_mssql_database does not have DTU setting #16114

Closed hugo-zhang-uipath closed 2 years ago

hugo-zhang-uipath commented 2 years ago

Hi, I am trying to change my terraform code use azurerm_mssql_database from the old one azurerm_sql_database. However my currently DB's are using DTU price tiers. But I don't see azurerm_mssql_database support DTU setting.

Lddeiva commented 2 years ago

Hi @hugo-zhang-uipath , Please use the commands az sql db list-editions -l <location> -o table or Get-AzSqlServerServiceObjective -Location <location> to get the supported list of Azure SQL database SKU's in your region. Then, you can use DTU based SKU to create your database.

The output should be something like this. image

Use the SKU you need in this attribute to create a DTU based database. image

Ref: - https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mssql_database

Sample: -


resource "azurerm_mssql_database" "test" {
  name           = "acctest-db-d"
  server_id      = azurerm_mssql_server.example.id
  collation      = "SQL_Latin1_General_CP1_CI_AS"
  license_type   = "LicenseIncluded"
  max_size_gb    = 1
  sku_name       = "P2"

  tags = {
    foo = "bar"
  }

}
sinbai commented 2 years ago

@hugo-zhang-uipath thank you for openning this issue. Does the above reply solve your problem? If not, could you please provide information about tf config and location of azurerm_sql_database?

Lddeiva commented 2 years ago

Hi @hugo-zhang-uipath , Can you please confirm if the solution provided worked or not? Thanks.

hugo-zhang-uipath commented 2 years ago

Hi @Lddeiva @sinbai , yes, it works for me! thanks! Closing this ticket

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.