Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Add user_custom_schema_attributes resource#183

Open
anton-yurchenko wants to merge 2 commits into
hashicorp:mainfrom
anton-yurchenko:main
Open

Add user_custom_schema_attributes resource#183
anton-yurchenko wants to merge 2 commits into
hashicorp:mainfrom
anton-yurchenko:main

Conversation

@anton-yurchenko

@anton-yurchenko anton-yurchenko commented Oct 17, 2021

Copy link
Copy Markdown

Hello,
This PR introduces a way to manage Custom Schema Attributes of already existing users. This is helpful when users are not managed through Terraform.

Example:

resource "googleworkspace_user_custom_schema_attributes" "test" {
  primary_email = "user@domain.com"

  custom_schemas {
    schema_name = "SAML"
    schema_values = {
      "SessionDuration" = jsonencode("300")
      "Role" = jsonencode(["backend", "frontend"])
    }
  }

  custom_schemas {
    schema_name = "AdditionalInfo"
    schema_values = {
      "GitHubUsername" = jsonencode("anton-yurchenko")
    }
  }
}

There is one caveat, however:
Terraform does not provide a way to diff against API itself, this might lead to deletion of Attributes that were not created with this resource.

@anton-yurchenko
anton-yurchenko marked this pull request as ready for review October 23, 2021 19:07
@anton-yurchenko anton-yurchenko changed the title Add 'user_custom_schema_attributes' resource Add user_custom_schema_attributes resource Oct 23, 2021
@tejavar

tejavar commented Oct 26, 2021

Copy link
Copy Markdown
Contributor

@anton-yurchenko - Hi ! Thank you for taking the time to create this PR.
Currently, we do not aim to address this issue as Terraform isn't designed to manage resources outside of its configuration. We suggest that you first import the users to terraform and then manage them. In that case, this feature is trivial.

Please feel to reach out if you have any issues.

Thanks !

@anton-yurchenko

Copy link
Copy Markdown
Author

Hey @tejavar,
Importing the users is impossible in our case as they are managed by an external system, this is the reason we need to maintain only a fracture of it.

I'll leave that PR intact in case you decide to address this issue.

Thanks!

@jbdevprimary

Copy link
Copy Markdown

Exactly what has already been said. There are very legitimate cases where only the schema attributes need to be managed and it is impossible to do an import. Thanks @anton-yurchenko. We need to inject SAML attributes for SSO. But our users cannot be managed or imported by Terraform.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants