Closed LuisMLGDev closed 3 years ago
Adding note: I just noted that in DocumentDB there is not an "admin" database which the normal one where we create the users... not sure if could be related to the issue...
Hey, I don't know if this can solve your problem but it looks very similar to what I experienced lately. Last week I was testing the creation of users with this provider against DocumentDB 4. I ran into your same error and started trying to investigate why. This is a snippet of what I tried last week:
resource "mongodb_db_user" "some_user" {
auth_database = "some_db"
name = "some_user"
password = "some_password"
role {
role = "readWrite"
db = "some_db"
}
}
GitLabCI pipelines were failing with
Error: user does not exist
even though the user was created in DocDB. But the user, inside DocDB, appeared like this:
{
"_id" : "some_user",
"user" : "some_user",
"db" : "admin",
"roles" : [
{
"db" : "some_db",
"role" : "readWrite"
}
]
}
Initially I didn't get why the "db"
line contained "admin"
as the auth_db associated to my user. I dropped it and changed Terraform code to the following:
resource "mongodb_db_user" "some_user" {
auth_database = "admin"
name = "some_user"
password = "some_password"
role {
role = "readWrite"
db = "some_db"
}
}
Now I don't get the error User does not exist
anymore. Give it a try!
Thanks a lot @guidoilbaldo ! I'm gonna try it for sure... I will keep you posted with the outcomings
Hi again guys!
I tried the workaround that @guidoilbaldo mentioned and for users creation is working fine but now the problem is when I remove an user then I get again the bloody message User does not exist
... and it's the same... the user is properly removed ... but it seems that stays in the terraform state file
Thanks in advance ...we are getting close :)
Bug fixed in version 0.0.9 Thank you for your support :)
Hi there! I'm using the last version 0.0.8 and DocumentDB 4. When I create a new user I got an error message but the user is created. After that the error message persists and when I run a
terraform plan
for example.mongodb_db_user.test01: Refreshing state... [id=62616e6b736167677265676174696f6e2e746573743031]
│ Error: user does not exist
Any ideas about how to get rid of this error?
Thanks!