-
Notifications
You must be signed in to change notification settings - Fork 62
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
Adding service account with group membership is bugged #212
Comments
Precision : |
Hi @csimard01! Thanks for the positive feedback! That always makes us feel good! I'm sorry you're experiencing this issue! I've tried it out and wasn't able to reproduce the problem. However, I'm not convinced we have this set up the same. Could you include your configuration to make sure what we have matches? For both the |
Hi @megan07 , we are also using this provider and I think that we have the same issue. This is our module config:
And we initialize the module with following:
Our settings:
The problem is, in some cases, the member is added to the group without any kind of And the user has not the permissions associated with that group. If we look into Google Admin Gsuite groups, we can found this member inside the group with Now, If we delete this user and recreate manually, this change works well and now we can find the correct kind of group member and the permissions applied correctly. |
Hi confirm alvarorm22 behavior. Adding it manually work well. |
We've try group and group_members. Id didn't work. Best regards |
To reproduce the problem here's what you can do. Google project 1
Google project 2
Use group or group members to add "cloud buid" of project 2 to group with permission on project 1 The service account "cloud build" will be added to the group but will not have read permission. However, if you add it manually, it will have permission... Regards |
@csimard01 @alvarorm22 I'm so sorry, I am still unable to reproduce this, with both suggestions.
Then, after apply, I jump to the console and look under Is there something you see that I am missing? |
Hi Megan,
Sorry for the delay. I'ts a busy time for me.
As mentioned in my precision
*The SA I'm trying to add is the Google cloud build in the format of
***@***.***
<http://cloudbuild.gserviceaccount.com> which is a Google created Service
account.*
Instead of using a service account you've created in the project #1, try to
add a service account automatically *created by Google*. This is where my
problems lie.
I've tried to add the Cloud build service account {project
***@***.***
***@***.***> and some other of the kind
and it didn't work. To ensure the appearance of the automatically created
SA, you may need to activate some service like cloudbuild and app engine in
the project #1.
resource "googleworkspace_group_members" "members" {
group_id = googleworkspace_group.group.id
members {
type = "USER"
email = google_service_account.onprem.email
role = "MEMBER"
}
members {
type = "USER"
email = data.google_bigquery_default_service_account.bq_sa.email
role = "MEMBER"
}
* members {*
* type = "USER"*
* email = ***@***.***
<http://cloudbuild.gserviceaccount.com>" # Ensure this service account
exist in project #1 *
* role = "MEMBER" }}*
If my explanation is not enough, I can recreate the entire code this
weekend.
Please let me know.
Best
Carl
…On Mon, Dec 13, 2021 at 4:00 PM megan07 ***@***.***> wrote:
@csimard01 <https://github.com/csimard01> @alvarorm22
<https://github.com/alvarorm22> I'm so sorry, I am still unable to
reproduce this, with both suggestions.
This code snippet is what I'm running, my intent is to encapsulate both
set-ups that you've suggested. Please let me know if I am missing an
important piece
terraform {
required_version = ">0.14, <1.1"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 3.80"
}
googleworkspace = {
source = "hashicorp/googleworkspace"
version = "~> 0.5.2"
}
}
}
resource "googleworkspace_group" "group" {
email = ***@***.***"
}
# Create service account
resource "google_service_account" "onprem" {
account_id = "my-sa"
display_name = "My SA"
}
# Create a bucket
resource "google_storage_bucket" "default" {
name = "my-bucket"
location = "us-central1"
force_destroy = true
}
# Create IAM permissions for the created group
resource "google_storage_bucket_iam_member" "member" {
bucket = google_storage_bucket.default.name
role = "roles/storage.objectViewer"
member = "group:${googleworkspace_group.group.email}"
}
resource "google_project_service" "bq-proj" {
project = "project-2"
service = "bigquery.googleapis.com"
disable_dependent_services = true
}
data "google_bigquery_default_service_account" "bq_sa" {
project = "project-2"
}
resource "googleworkspace_group_members" "members" {
group_id = googleworkspace_group.group.id
members {
type = "USER"
email = google_service_account.onprem.email
role = "MEMBER"
}
members {
type = "USER"
email = data.google_bigquery_default_service_account.bq_sa.email
role = "MEMBER"
}
}
Then, after apply, I jump to the console and look under Group Details and
see both members listed with type Service account, then I go to Policy
Analyzer > Custom Query, I run it twice (with "Principal" and each email
address) and both show the created bucket and the "Storage Object Viewer"
role grant.
Is there something you see that I am missing?
Thank you for your patience in this!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#212 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWRL5D6XA2LGSIEHKNY23GLUQZNGVANCNFSM5IHMAPHA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
--
Carl Simard
Datasophia
--
This message (and any associated files) may contain confidential and/or
privileged information. If you are not the intended recipient or authorized
to receive this for the intended recipient, you must not use, copy,
disclose or take any action based on this message or any information
herein. If you have received this message in error, please advise the
sender immediately by sending a reply email and delete this message. Thank
you for your cooperation.
|
the name of the service account didn't parse well. Here is the name |
Hi @csimard01, sorry for the confusion, I should have noted:
is the Google-created default service account for big query ( No worries on the delay, I totally understand! If you see anything else with my set-up that isn't correct, please let me know! I'll keep digging into it as best I can. Thanks! |
Hi @csimard01 @alvarorm22 , I wanted to follow up to see if you were still encountering this issue. |
Hi Google Workspace terraform team,
I love your provider and I'm happy to have it.
I'm using googleworkspace_group_members to add a google Service Account to a group.
Expected behavior
The text was updated successfully, but these errors were encountered: