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.55k stars 4.62k forks source link

New resource: azurerm_mssql_database with support for vCore model #2849

Closed kjhosein closed 4 years ago

kjhosein commented 5 years ago

Community Note

Description

Please add support for the vCore licensing model to the single SQL database resource or create a new resource that does.

(I had originally opened this in ticket #1779, but it was closed and I was unable to re-open it.)

New Resource(s)

Potential Terraform Configuration

resource "azurerm_mssql_database" "test" {
  name                = "MyDatabase"
  resource_group_name = "best_rg_ever"
  location            = "West US"
  server_name         = "mysqlserver1"
  sku {
    name     = "GP_Gen5"
    capacity = 4
    tier     = "GeneralPurpose"
    family   = "Gen5"
  }

  per_database_settings {
    min_capacity = 0.25
    max_capacity = 4
  }
}

Structured the above potential sample code similarly to the azurerm_mssql_elasticpool resource.

References

Kevat commented 4 years ago

Will this change include any of the following:

  1. Support for General Purpose, Hyperscale and Business Critical options as a part of the "tier" setting?
  2. Support for Provisioned vs. Serverless options as a part of the "Compute Tier" setting for General Purpose?
  3. Support for Secondary Replicate for Hyperscale?
  4. Support for Read Scale Out for Business Critical?
frugecn commented 4 years ago

Any update on this request? With the move away from DTU model to vCore model, we really need to get this one out the door, please.

frugecn commented 4 years ago

This doesn't necessarily need to be a new resource. It can be a modification to azurerm_sql_database. We just need to add the sku like we did in the elastic pool #1745

ranokarno commented 4 years ago

@frugecn is correct, we can just modify "requested_service_objective_name" to spin up VCORE database.

  name                = "mysqldatabase"
  resource_group_name = "${azurerm_resource_group.example.name}"
  location            = "West US"
  server_name         = "${azurerm_sql_server.example.name}"
  requested_service_objective_name = "GP_Gen4_1"

  tags = {
    environment = "production"
  }
}

can refer to this link here to find out more https://docs.microsoft.com/en-us/rest/api/sql/databases/createorupdate#database az sql db list-editions -l <location> -o table

yupwei68 commented 4 years ago

I'm working on this.

ghost commented 4 years ago

This has been released in version 2.3.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.3.0"
}
# ... other configuration ...
adback03 commented 4 years ago

Can someone explain why this is a new resource? When should we be using azurerm_sql_database versus azurerm_mssql_database? Is the old one going to get deprecated?

yupwei68 commented 4 years ago

hi @adback03 ,You're right that the old one is going to be deprecated. But currently, we want to still support the old ones while those still are in use.

ghost commented 4 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 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 👉 hashibot-feedback@hashicorp.com. Thanks!