terraform-provider-googleworkspace icon indicating copy to clipboard operation
terraform-provider-googleworkspace copied to clipboard

Add `user_custom_schema_attributes` resource

Open anton-yurchenko opened this issue 3 years ago • 3 comments

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 = "[email protected]"

  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 avatar Oct 17 '21 20:10 anton-yurchenko

@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 !

tejavar avatar Oct 26 '21 14:10 tejavar

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!

anton-yurchenko avatar Oct 29 '21 07:10 anton-yurchenko

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.

jbcom avatar Dec 22 '21 20:12 jbcom