Creates the Google Cloud service account used by Dex's SSO to look up Google group
membership (e.g. engineering@code.org? infrastructure@code.org?) for @code.org
accounts and thereby determine in-cluster access levels.
This is shared infrastructure for all codeai-k8s clusters, so you only have to run this once at first bootstrap, not per-cluster created.
-
Review and edit
terraform.tfvarsas needed -
Run:
# Install Google Cloud SDK
# or: `curl https://sdk.cloud.google.com | bash` on linux
brew install gcloud
# will popup a browser for google login with @code.org
gcloud auth login
tofu init
export GOOGLE_OAUTH_ACCESS_TOKEN="$(gcloud auth print-access-token)"
tofu apply- Now that you've created a new Google Cloud service account, you need to get a Google Workspace superadmin to bless it:
- This will allow Dex's SSO system read-only access to employee's google groups (e.g. engineering@code.org), which Dex needs to know what permissions to grant them.
- Provide a Google Workspace super admin (e.g. infra manager) with:
- Service Account Client ID, from
tofu applyoutput valuegoogle_service_account_client_id(at the end of tofu apply output) - Requested OAuth Scope:
https://www.googleapis.com/auth/admin.directory.group.readonly
- Service Account Client ID, from
- Request super admin manage your service account's domain wide delegation:
- Excerpted from: https://developers.google.com/workspace/guides/create-credentials#optional_set_up_domain-wide_delegation_for_a_service_account
- Open Google Workspace Admin console: Security > Access and data control > API controls
- Click
[Manage Domain Wide Delegation]->[Add New] - Input the service account client_id you provide them
- Input the oauth_scope
https://www.googleapis.com/auth/admin.directory.group.readonly - Click
[Authorize]