Open pregress opened 5 months ago
If your create multiple mssql_users against multiple database on the same server you get a lot of errors: failures to connect, failures to sign in, timeouts.
mssql_users
Example errors:
context deadline exceeded db connection failed after 30s timeout
context deadline exceeded
db connection failed after 30s timeout
you can bypass this by applying with parallelism set to 1, but this is not recommended. terraform apply --auto-approve -parallelism 1 https://developer.hashicorp.com/terraform/internals/graph#walking-the-graph
terraform apply --auto-approve -parallelism 1
See example below, local.user_databases is a list with 25 values.
local.user_databases
data "azurerm_resources" "sql_databases" { type = "Microsoft.Sql/servers/databases" resource_group_name ="resource_group" } locals { user_databases = [for db in data.azurerm_resources.sql_databases.resources : db if db.name != "servername/master"] } resource "mssql_user" "example" { for_each = { for db in local.user_databases : db.name => db } server { host = data.azurerm_mssql_server.example.fully_qualified_domain_name login { username = "example" password = data.azurerm_key_vault_secret.example.value } } object_id = azurerm_user_assigned_identity.example.client_id database = replace(each.value.name,"servername/","") username = azurerm_user_assigned_identity.example.name roles = ["db_reader"] }
The problem is even worse when you connect with azuread_default_chain_auth
azuread_default_chain_auth
If your create multiple
mssql_users
against multiple database on the same server you get a lot of errors: failures to connect, failures to sign in, timeouts.Example errors:
you can bypass this by applying with parallelism set to 1, but this is not recommended.
terraform apply --auto-approve -parallelism 1
https://developer.hashicorp.com/terraform/internals/graph#walking-the-graphSee example below,
local.user_databases
is a list with 25 values.The problem is even worse when you connect with
azuread_default_chain_auth