@@ -21,15 +21,17 @@ import (
2121)
2222
2323var (
24- org string
25- orgEmail string
26- project string
27- updateTables bool
24+ org string
25+ orgEmail string
26+ project string
27+ credentialsProject string
28+ updateTables bool
2829)
2930
3031func init () {
3132 flag .StringVar (& org , "org" , "" , "Organization name. Must match name assigned by M-Lab" )
3233 flag .StringVar (& project , "project" , "" , "GCP project to create organization resources" )
34+ flag .StringVar (& credentialsProject , "credentials-project" , "" , "GCP project for credentials Datastore (defaults to -project)" )
3335 flag .BoolVar (& updateTables , "update-tables" , false , "Allow this org's service account to update table schemas" )
3436 flag .StringVar (& orgEmail , "org-email" , "" , "Organization contact email" )
3537}
@@ -57,13 +59,17 @@ func main() {
5759 rtx .Must (err , "failed to create new dns service" )
5860 d := dnsx .NewManager (dnsiface .NewCloudDNSService (dnsService ), project , dnsname .ProjectZone (project ))
5961
60- // Create Datastore client
61- dsc , err := datastore .NewClient (ctx , project )
62+ // Setup Datastore client for credentials (may be in a different project)
63+ credProj := credentialsProject
64+ if credProj == "" {
65+ credProj = project
66+ }
67+ dsc , err := datastore .NewClient (ctx , credProj )
6268 rtx .Must (err , "failed to create datastore client" )
6369 defer dsc .Close ()
6470
6571 // Initialize AutojoinManager from token-exchange with the correct namespace.
66- am := store .NewAutojoinManager (dsc , project , "platform-credentials" )
72+ am := store .NewAutojoinManager (dsc , credProj , "platform-credentials" )
6773
6874 o := adminx .NewOrg (project , crmiface .NewCRM (project , crm ), sa , sm , d , am , updateTables )
6975 err = o .Setup (ctx , org , orgEmail )
0 commit comments