I've written a module that creates a login and a user. I set the count to 2 in order. The second user fails with the output below.
module.sql_readwrite_user[1].mssql_login.user: Creation complete after 1s [id=sqlserver://foo.database.windows.net:1433/svc_calorders_readwrite_2]
module.sql_readwrite_user[0].mssql_login.user: Creation complete after 1s [id=sqlserver://foo.database.windows.net:1433/svc_calorders_readwrite_1]
module.sql_readwrite_user[1].mssql_user.user: Creating...
module.sql_readwrite_user[0].mssql_user.user: Creating...
module.sql_readwrite_user[1].mssql_user.user: Creation complete after 1s [id=sqlserver://foo.database.windows.net:1433/MYDB/svc_calorders_readwrite_2]
╷
│ Error: unable to create user [MYDB].[svc_calorders_readwrite_1]: mssql: There is already an object named 'String_Split' in the database.
│
│ with module.sql_readwrite_user[0].mssql_user.user,
│ on sql_login/main.tf line 24, in resource "mssql_user" "user":
│ 24: resource "mssql_user" "user" {
This seems to be related to #17. It appears to be a race condition where the 2nd concurrent user resource tries to create the split function but then fails as it now exists.
Should the function check/creation be in transaction, or the "exists" test should be repeated inside the create statement?
Version: betr-io/mssql v0.2.3
I've written a module that creates a login and a user. I set the count to 2 in order. The second user fails with the output below.
This seems to be related to #17. It appears to be a race condition where the 2nd concurrent user resource tries to create the split function but then fails as it now exists.
Should the function check/creation be in transaction, or the "exists" test should be repeated inside the create statement?