You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you create a Azure SQL Database in the "Serverless" compute tier, the database is able to automatically pause and resume. This will lead to the following behaviour.
Changes to anything within the database after the database is paused will fail because the db is not available:
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# mssql_schema.example will be created
+ resource "mssql_schema" "example" {
+ database_id = "8"
+ id = (known after apply)
+ name = "example"
+ owner_id = (known after apply)
}
# mssql_sql_user.example will be created
+ resource "mssql_sql_user" "example" {
+ database_id = "8"
+ id = (known after apply)
+ login_id = "0x010600000000006400000000000000003D15DD8D6929D94DB9AC9C6DBC213200"
+ name = "example"
}
Plan: 2 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
mssql_sql_user.example: Creating...
mssql_sql_user.example: Still creating... [10s elapsed]
╷
│ Error: Failed to create user
│
│ with mssql_sql_user.example,
│ on contoso_dev_mssql.tf line 93, in resource "mssql_sql_user" "example":
│ 93: resource "mssql_sql_user" "example" {
│
│ mssql: login error: Database 'testdb_1' on server 'terraform-mssql-test-local.database.windows.net' is not currently available. Please retry the connection later. If the problem
│ persists, contact customer support, and provide them the session tracing ID of '{XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'.
However, this will trigger the auto-resume of the database. According to the documentation this will take approx. one minute. If you then apply the same changes, the changes will be applied successfully:
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# mssql_schema.example will be created
+ resource "mssql_schema" "example" {
+ database_id = "8"
+ id = (known after apply)
+ name = "example"
+ owner_id = (known after apply)
}
# mssql_sql_user.example will be created
+ resource "mssql_sql_user" "example" {
+ database_id = "8"
+ id = (known after apply)
+ login_id = "0x010600000000006400000000000000003D15DD8D6929D94DB9AC9C6DBC213200"
+ name = "example"
}
Plan: 2 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
mssql_sql_user.example: Creating...
mssql_sql_user.example: Creation complete after 4s [id=8/5]
mssql_schema.example: Creating...
mssql_schema.example: Creation complete after 3s [id=8/5]
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
Example code to test the issue (you'll need to wait for 60min after the first run to trigger the auto-pause, and then change anthing within the database resources):
If you create a Azure SQL Database in the "Serverless" compute tier, the database is able to automatically pause and resume. This will lead to the following behaviour.
Changes to anything within the database after the database is paused will fail because the db is not available:
However, this will trigger the auto-resume of the database. According to the documentation this will take approx. one minute. If you then apply the same changes, the changes will be applied successfully:
Example code to test the issue (you'll need to wait for 60min after the first run to trigger the auto-pause, and then change anthing within the database resources):
The text was updated successfully, but these errors were encountered: