1
- # Terraform G Suite Provider
1
+ Terraform Provider - G Suite
2
+ ==================
2
3
3
- This is a terraform provider for managing G Suite (Admin SDK) resources on Google
4
+ - Website: https://registry.terraform.io/providers/DeviaVir/gsuite/latest/docs
5
+ - [ ![ Gitter chat] ( https://badges.gitter.im/hashicorp-terraform/Lobby.png )] ( https://gitter.im/hashicorp-terraform/Lobby )
6
+ - Mailing list: [ Google Groups] ( http://groups.google.com/group/terraform-tool )
4
7
5
- ## Authentication
8
+ < img src = " https://cdn.rawgit.com/hashicorp/terraform-website/master/content/source/assets/images/logo-hashicorp.svg " width = " 600px " >
6
9
7
- There are two possible authentication mechanisms for using this provider.
8
- Using a service account, or a personal admin account. The latter requires
9
- user interaction, whereas a service account could be used in an automated
10
- workflow.
10
+ Maintainers
11
+ -----------
11
12
12
- See the necessary oauth scopes both for service accounts and users below:
13
- - https://www.googleapis.com/auth/admin.directory.group
14
- - https://www.googleapis.com/auth/admin.directory.user
13
+ This provider plugin is maintained by Chase Sillevis.
15
14
16
- You could also provide the minimal set of scopes using the
17
- ` oauth_scopes ` variable in the provider configuration.
15
+ Requirements
16
+ ------------
18
17
19
- ```
20
- provider "gsuite" {
21
- oauth_scopes = [
22
- "https://www.googleapis.com/auth/admin.directory.group",
23
- "https://www.googleapis.com/auth/admin.directory.user"
24
- ]
25
- }
26
- ```
18
+ - [ Terraform] ( https://www.terraform.io/downloads.html ) 0.11.x
19
+ - [ Go] ( https://golang.org/doc/install ) 1.14 (to build the provider plugin)
27
20
28
- ** NOTE** If you are creating or modifying schemas and custom user attributes
29
- you will need the following additional scope:
30
-
31
- https://www.googleapis.com/auth/admin.directory.userschema
32
-
33
- ** NOTE 2** If you are creating or modifying group settings
34
- you will need the following additional scope:
35
-
36
- https://www.googleapis.com/auth/apps.groups.settings
37
-
38
- ### Using a service account
39
-
40
- Service accounts are great for automated workflows.
41
-
42
- Only users with access to the Admin APIs can access the Admin SDK Directory API,
43
- therefore the service account needs to impersonate one of those users
44
- to access the Admin SDK Directory API.
45
-
46
- Follow the instruction at
47
- https://developers.google.com/admin-sdk/directory/v1/guides/delegation .
48
-
49
- Add ` credentials ` and ` impersonated_user_email ` when initializing the provider.
50
- ```
51
- provider "gsuite" {
52
- credentials = "/full/path/service-account.json"
53
- impersonated_user_email = "admin@xxx.com"
54
- }
55
- ```
56
-
57
- Credentials can also be provided via the following environment variables:
58
- - GOOGLE_CREDENTIALS
59
- - GOOGLE_CLOUD_KEYFILE_JSON
60
- - GCLOUD_KEYFILE_JSON
61
- - GOOGLE_APPLICATION_CREDENTIALS
62
- - IMPERSONATED_USER_EMAIL
63
-
64
- ### Using a personal administrator account
65
-
66
- In order to use the Admin SDK with a project, we will first need to create
67
- credentials for that project, you can do so here:
68
-
69
- https://console.cloud.google.com/apis/credentials?project=[project_ID ]
70
-
71
- Please make sure to create an OAuth 2.0 client, and download the file to your
72
- local directory.
73
-
74
- You can now use that credential to authenticate:
75
-
76
- ```
77
- $ gcloud auth application-default login \
78
- --client-id-file=client_id.json \
79
- --scopes \
80
- https://www.googleapis.com/auth/admin.directory.group,\
81
- https://www.googleapis.com/auth/admin.directory.user,
82
- ```
83
-
84
- Now that you have a credential that is allowed to the Admin SDK, you can use the
85
- G Suite provider.
86
-
87
- ## Installation
21
+ Installing the Provider
22
+ ---------------------
88
23
89
24
1 . Download the latest compiled binary from [ GitHub releases] ( https://github.com/DeviaVir/terraform-provider-gsuite/releases ) .
90
25
@@ -105,7 +40,8 @@ G Suite provider.
105
40
106
41
This will find the plugin locally.
107
42
108
- # # Development
43
+ Building The Provider
44
+ ---------------------
109
45
110
46
1. ` cd` into ` $HOME /.terraform.d/plugins/terraform-provider-gsuite`
111
47
@@ -116,25 +52,3 @@ G Suite provider.
116
52
1. Run ` make dev` and in your ` terraform` directory, remove the current ` .terraform` and re-run ` terraform init`
117
53
118
54
1. Next time you run ` terraform plan` it' ll use your updated version
119
-
120
- ### Relevant Google Admin SDK Documentation
121
- #### General
122
- * http://google.golang.org/api/admin/directory/v1
123
- * https://developers.google.com/admin-sdk/directory/v1/reference/
124
-
125
- #### Schema Types
126
- * https://developers.google.com/admin-sdk/directory/v1/reference/users
127
- * https://developers.google.com/admin-sdk/directory/v1/reference/groups
128
- * https://developers.google.com/admin-sdk/directory/v1/reference/schemas
129
-
130
- When using a service account, make sure to add:
131
- `https://www.googleapis.com/auth/admin.directory.userschema`
132
- to the `oauth_scopes` list, otherwise you will be missing permissions to manage
133
- user schemas.
134
-
135
- ## Notes
136
-
137
- - Asking too many permissions right now, but rather start out with too much and tone down later on
138
- - Quite limited, as it is a huge API, I have only added the parts I plan on using
139
- - Open for PR' s to extend functionality
140
- - Documentation is still to be written, you can refer to the ` examples` directory for now
0 commit comments