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
I'm trying to create contained database users right after a database has been created using the azurerm_mssql_database resourrce. However the mssql_user create request fails for various reasons: Error: unable to read user [my-database-name].[my-user]: login error: mssql: Login failed for user 'admin'.
Another error: Error: unable to create user [my-database-name].[my-user]: SQL Server had internal error
When retrying a moment later by planning and applying only the failed user terraform succeeds.
There seems to be some sort of timing issue where the database has been created but is not ready to receive any commands yet. I've seen this problem before when provisioning a local containerized instance of SQL Server and trying to connect and execute scripts right after using sqlcmd. A delay in-between seems to sort it out, but it's of course a hacky, brittle solution.
The text was updated successfully, but these errors were encountered:
I'm trying to create contained database users right after a database has been created using the azurerm_mssql_database resourrce. However the mssql_user create request fails for various reasons: Error: unable to read user [my-database-name].[my-user]: login error: mssql: Login failed for user 'admin'. Another error: Error: unable to create user [my-database-name].[my-user]: SQL Server had internal error
When retrying a moment later by planning and applying only the failed user terraform succeeds.
There seems to be some sort of timing issue where the database has been created but is not ready to receive any commands yet. I've seen this problem before when provisioning a local containerized instance of SQL Server and trying to connect and execute scripts right after using sqlcmd. A delay in-between seems to sort it out, but it's of course a hacky, brittle solution.
How did you manage to create a delay? Knowing this would help me until I find a solution. I tried with the create_duration parameter but it doesn't seem to be compatible.
I'm trying to create contained database users right after a database has been created using the
azurerm_mssql_database
resourrce. However themssql_user
create request fails for various reasons:Error: unable to read user [my-database-name].[my-user]: login error: mssql: Login failed for user 'admin'.
Another error:
Error: unable to create user [my-database-name].[my-user]: SQL Server had internal error
When retrying a moment later by planning and applying only the failed user terraform succeeds.
There seems to be some sort of timing issue where the database has been created but is not ready to receive any commands yet. I've seen this problem before when provisioning a local containerized instance of SQL Server and trying to connect and execute scripts right after using
sqlcmd
. A delay in-between seems to sort it out, but it's of course a hacky, brittle solution.The text was updated successfully, but these errors were encountered: