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

As a non admin user can i use this provider? #178

Description

@damaya

Hi @DeviaVir I have tested the provider, and it works so good using admin credentials. Thanks for this.

However i have this question: Does this provider work if we use impersonated email without admin privileges, or do you have some workaround in progress, or we are limited by the same scope of the Google api itself?

Scenario

  1. As a non admin user e.g developerx@anycompany.com i am able to create groups from the Gsuite workspace https://groups.google.com/all-groups

  2. As the same non admin user developerx@anycompany.com i use the gcloud credentials and the plan works as expected, but i cannot import any of pre-existed groups, as it just through this provider i could not create/manage none of the gsuite resources i created before manually.

  3. Taking point 1,2 i am using the provider like this, and as i said before, it worked perfect using an admin user, but in the second scenario, it did not,

provider "gsuite" {
    oauth_scopes = [
    "https://www.googleapis.com/auth/admin.directory.group",
    "https://www.googleapis.com/auth/apps.groups.settings",
  ]

  impersonated_user_email = var.impersonated_user_email
  credentials = var.gsuite_credentials
}

where impersonated_user_email is developerx@anycompany.com, and credentials is the path with json data i get when i authenticate with gcloud, example "/home/developerx/.config/gcloud/application_default_credentials.json"

  1. Importing a pre existing Group:

Having this resource coded lilke:

resource "gsuite_group" "test" {
  email       = "test@anycompany.com"
  name        = "Test"
}

And being sure the group already exists with mail "test@anycompany.com" , i run the import command like

terraform import gsuite_group.test "test@anycompany.com"

The error when importing a pre-existing group (which i can see from GCP account and from Gsuite workspace) is this:

Error: [ERROR] Error fetching group. Make sure the group exists: Get "https://admin.googleapis.com/admin/directory/v1/groups/test%40anydomain.com?alt=json&prettyPrint=false": private key should be a PEM or plain PKCS1 or PKCS8; parse error: asn1: syntax error: sequence truncated

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions