mongodb / terraform-provider-mongodbatlas

Terraform MongoDB Atlas Provider: Deploy, update, and manage MongoDB Atlas infrastructure as code through HashiCorp Terraform
https://registry.terraform.io/providers/mongodb/mongodbatlas
Mozilla Public License 2.0
244 stars 172 forks source link

custom_db_roles cannot be created with only inherited roles #279

Closed languitar closed 4 years ago

languitar commented 4 years ago

In the Atlas UI it is easily possible to create custom_db_roles which are comprised of only inherited roles. However, the resource definition currently requires one to always pass actions. Therefore, I don't see a chance to create roles which only use inherited roles such as this example: image

themantissa commented 4 years ago

@languitar thank you for the report - it seems that when custom roles was created the actions was defined as required, https://github.com/mongodb/terraform-provider-mongodbatlas/blob/master/mongodbatlas/resource_mongodbatlas_custom_db_role.go#L50 but should be optional. Will file a ticket to get this addressed. Thank you!

themantissa commented 4 years ago

See https://github.com/mongodb/terraform-provider-mongodbatlas/issues/280 as well for more around the impact of the behavior.

languitar commented 4 years ago

Another aspect of this thing could be the following:

      ~ inherited_roles {
          ~ database_name = "history" -> "userdata"
            role_name     = "readWrite"
        }
        inherited_roles {
            database_name = "catalog"
            role_name     = "readWrite"
        }
      ~ inherited_roles {
          ~ database_name = "userdata" -> "cache"
            role_name     = "readWrite"
        }
      ~ inherited_roles {
          ~ database_name = "cache" -> "history"
            role_name     = "readWrite"
        }

Seems the sorting wasn't correctly applied in the previous iteration and now this diff reappears everytime.

PacoDw commented 4 years ago

Hello, @languitar thank you so much for your review, I made changes resolving this issue could you test it to check if everything is okay? Also, let me know if you have another comment or concern, thanks.

languitar commented 4 years ago

Thanks for the fix. Are there any plans to generate a release including this fix?

themantissa commented 4 years ago

@languitar there are - we plan to cut 0.6.4, hopefully, in Aug (that is pretty soon). We are still finishing up some changes to be able to deploy releases ourselves (a new change for Terraform .13).