Azure SQL has a serverless edition. It would be great if this is possible to setup with terraform.
resource "azurerm_sql_database" "test" {
name = "mysqldatabase"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "West US"
server_name = "${azurerm_sql_server.test.name}"
edition = "Serverless"
max_vcore = 3
min_vcore = 1
auto_pause_delay_in_minutes = 720
}
https://docs.microsoft.com/en-us/azure/sql-database/sql-database-serverless
hi @StefanSchoof
Thanks for opening this issue :)
Taking a look through this appears to be a duplicate of #1747 - rather than having multiple issues open tracking the same thing I'm going to close this issue in favour of that one; would you mind subscribing to #1747 for updates?
Thanks!
Thanks for the quick reply.
I do not thing this is a duplicate. In the whole #1747 is no mention of serverless. Do you think #1747 should also add the serverless edition (it is in preview)?
@StefanSchoof thanks for the clarification - I'd agree this makes sense to re-open/track separately
Hi Tombuild,
Do you have update on the above mentioned information? I am waiting for something on terraform. If you don't have option. Kindly inform me.
SQL Serverless is now out of preview: https://azure.microsoft.com/en-us/updates/azure-sql-database-serverless-is-now-generally-available/
Do we Terraform support to create database ComputeModel Serverless yet?
29 upvotes for this request, and this Azure service has now been in GA for 3 months. Any chance the folks from Terraform could provide some advice on where this currently is in the planning?
I was able to create a serverless SQL DB using edition as "GeneralPurpose" and requested_service_objective_name with value like "GP_S_Gen5_2" i.e. Gen5 and vcpu =2.
Sample:
resource "azurerm_sql_database" "testdb" {
name = "testdb"
resource_group_name = "testrg"
location = ####
server_name = #####
create_mode = "Default"
edition = "GeneralPurpose"
max_size_bytes = "34359738368"
requested_service_objective_name = "GP_S_Gen5_${var.dbvcpu}"
}
Hope this helps.
@abhidhar82 that is definitely helpful! One question though - the vCore number you use, does that get used as the minimum or the maximum? With SQL Serverless, a range between min and max number of vCores can be specified, so just wondering which would be referred to here, and how to set the other one?
@DaRosenberg good question. I have observed if you set the vCore to 4 then the min is set 2 and max 4 with autopause as 1 hour. I wasn't able to find away to set these.
Fixed via #6083
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 ...
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!
Most helpful comment
SQL Serverless is now out of preview: https://azure.microsoft.com/en-us/updates/azure-sql-database-serverless-is-now-generally-available/