Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE] Allow import of existing scim_user and scim_group resources #288

Closed
al-lac opened this issue Aug 31, 2020 · 3 comments · Fixed by #290
Closed

[ISSUE] Allow import of existing scim_user and scim_group resources #288

al-lac opened this issue Aug 31, 2020 · 3 comments · Fixed by #290
Assignees
Labels
bug Something isn't working
Milestone

Comments

@al-lac
Copy link
Contributor

al-lac commented Aug 31, 2020

It should be possible to import existing scim users and groups into the terraform state file. The documentation for version 0.2.4 already includes an import section: https://registry.terraform.io/providers/databrickslabs/databricks/latest/docs/resources/scim_user

The documentation for the scim_group resource is missing completely.

Terraform Version

0.12.29

Provider Version

0.2.4

Affected Resource(s)

Please list the resources as a list, for example:

  • databricks_scim_user
  • databricks_scim_group

Expected Behavior

I should be able to import these resources into the state file.

Actual Behavior

I get a message that says it is currently not supported.

Steps to Reproduce

terraform import 'databricks_scim_user.test["user@azuredomain.com"]' 6051372335468901
databricks_scim_user.de["user@azuredomain.com"]: Importing from ID "6051372335468901"...

Error: resource databricks_scim_user doesn't support import

Important Factoids

Are there anything atypical about your accounts that we should know?

@al-lac al-lac added the bug Something isn't working label Aug 31, 2020
@nfx nfx self-assigned this Sep 1, 2020
nfx added a commit that referenced this issue Sep 1, 2020
And updated documentation for all resources, making it more clear to end user.
@nfx nfx linked a pull request Sep 1, 2020 that will close this issue
@nfx
Copy link
Contributor

nfx commented Sep 1, 2020

@al-lac what do you use this resource for? please use databricks_group instead of databricks_scim_group. We're not recommending extensive use of databricks_scim_user, because it's way more manageable to create few databricks_group instances with all related permissions to them and let Identity provider use SCIM provisioning to populate users into those groups.

@al-lac
Copy link
Contributor Author

al-lac commented Sep 1, 2020

@nfx ah yes, you are right, i will use databricks_group instead. But i need to use databricks_scim_user to sync my users from Azure. I am not sure on how to populate the groups without using the terraform provider or the API.

@nfx nfx added this to the v0.3.0 milestone Sep 3, 2020
@nfx nfx closed this as completed in #290 Sep 8, 2020
nfx added a commit that referenced this issue Sep 8, 2020
* Fix #288 - Added importers for SCIM resource

And updated documentation for all resources, making it more clear to end user.

* Fix lint

Co-authored-by: Serge Smertin <serge.smertin@databricks.com>
@al-lac
Copy link
Contributor Author

al-lac commented Sep 14, 2020

Import is now possible, but on the next terraform plan the user would be replaced because the 'user_name' attribute is missing in the state file. Also the user is admin per default in the state.

terraform import 'databricks_scim_user.test-group-dev["testuser-dev@company.com"]' 1599117335337769

terraform state show 'databricks_scim_user.test-group-dev["testuser-dev@company.com"]'# databricks_scim_user.test-group-dev["testuser-dev@company.com"]:
resource "databricks_scim_user" "data-scientists-dev" {
    entitlements    = []
    id              = "1599117335337769"
    inherited_roles = []
    roles           = []
    set_admin       = true
}


terraform plan
  # databricks_scim_user.test-group-dev["testuser-dev@company.com"] must be replaced
-/+ resource "databricks_scim_user" "test-group-dev" {
      + display_name    = "Testuser DEV"
      ~ entitlements    = [
          + "allow-cluster-create",
        ]
      ~ id              = "1599117335337769" -> (known after apply)
      ~ inherited_roles = [] -> (known after apply)
      - roles           = [] -> null
      ~ set_admin       = true -> false
      + user_name       = "testuser-dev@company.com" # forces replacement
    }

Should be possible to import the user_name as well i hope.

@nfx nfx modified the milestones: v0.3.0, 0.2.6 Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants