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

Commit bd35d8f

Browse files
committed
website: init docs
1 parent 7570c5b commit bd35d8f

19 files changed

+1405
-107
lines changed

Makefile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Metadata about this makefile and position
22
MKFILE_PATH := $(lastword $(MAKEFILE_LIST))
33
CURRENT_DIR := $(patsubst %/,%,$(dir $(realpath $(MKFILE_PATH))))
4+
WEBSITE_REPO := github.com/hashicorp/terraform-website
45

56
# Ensure GOPATH
67
GOPATH ?= $(HOME)/go
@@ -16,7 +17,8 @@ GOMAXPROCS ?= 8
1617

1718
# Get the project metadata
1819
GOVERSION := 1.14
19-
PROJECT := github.com/DeviaVir/terraform-provider-gsuite
20+
PKG_NAME := gsuite
21+
PROJECT := github.com/DeviaVir/terraform-provider-$(PKG_NAME)
2022
OWNER := $(notdir $(patsubst %/,%,$(dir $(PROJECT))))
2123
NAME := $(notdir $(PROJECT))
2224
VERSION := 0.1.49
@@ -106,7 +108,7 @@ dev: vendor
106108
-mod vendor \
107109
-ldflags "${LD_FLAGS}" \
108110
-tags "${GOTAGS}" \
109-
-o "${PLUGIN_PATH}/terraform-provider-gsuite"
111+
-o "${PLUGIN_PATH}/terraform-provider-${PKG_NAME}"
110112

111113
# test runs all tests
112114
test:
@@ -198,3 +200,19 @@ _sign:
198200
@echo ""
199201
@echo "And then upload the binaries in dist/!"
200202
.PHONY: _sign
203+
204+
website:
205+
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
206+
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
207+
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
208+
endif
209+
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
210+
.PHONY: website
211+
212+
website-test:
213+
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
214+
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
215+
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
216+
endif
217+
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
218+
.PHONY: website-test

README.md

Lines changed: 17 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,25 @@
1-
# Terraform G Suite Provider
1+
Terraform Provider - G Suite
2+
==================
23

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)
47

5-
## Authentication
8+
<img src="https://cdn.rawgit.com/hashicorp/terraform-website/master/content/source/assets/images/logo-hashicorp.svg" width="600px">
69

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+
-----------
1112

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.
1514

16-
You could also provide the minimal set of scopes using the
17-
`oauth_scopes` variable in the provider configuration.
15+
Requirements
16+
------------
1817

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)
2720

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+
---------------------
8823

8924
1. Download the latest compiled binary from [GitHub releases](https://github.com/DeviaVir/terraform-provider-gsuite/releases).
9025

@@ -105,7 +40,8 @@ G Suite provider.
10540

10641
This will find the plugin locally.
10742

108-
## Development
43+
Building The Provider
44+
---------------------
10945

11046
1. `cd` into `$HOME/.terraform.d/plugins/terraform-provider-gsuite`
11147

@@ -116,25 +52,3 @@ G Suite provider.
11652
1. Run `make dev` and in your `terraform` directory, remove the current `.terraform` and re-run `terraform init`
11753

11854
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

examples/custom-attributes/custom-attributes.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ resource "gsuite_user" "user" {
3535

3636
resource "gsuite_user_attributes" "user_attributes" {
3737
primary_email = gsuite_user.user.primary_email
38-
custom_schema = data.gsuite_user_attributes.details.json
38+
custom_schema = data.gsuite_user_attributes.details.json
3939
}

gsuite/resource_user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ func resourceUserCreate(d *schema.ResourceData, meta interface{}) error {
583583
}
584584
}
585585

586-
// Transimt password related state on account creation only.
586+
// Transmit password related state on account creation only.
587587
if v, ok := d.GetOk("password"); ok {
588588
log.Printf("[DEBUG] Setting %s: %s", "password", v.(string))
589589
user.Password = v.(string)

website/docs/d/group.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
layout: "gsuite"
3+
page_title: "G Suite: group data source"
4+
sidebar_current: "docs-gsuite-datasource-group"
5+
description: |-
6+
Retrieves a Group in G Suite.
7+
---
8+
9+
# gsuite\_group
10+
11+
Reads a Group from G Suite
12+
13+
## Example Usage
14+
15+
```hcl
16+
data "gsuite_group" "example" {
17+
email = "example@domain.ext"
18+
}
19+
20+
output "group" {
21+
value = data.gsuite_group.example
22+
}
23+
```
24+
25+
## Argument Reference
26+
27+
The following arguments are supported:
28+
29+
* `email` - (Required) The email of the group.
30+
31+
## Attributes Reference
32+
33+
In addition to the above arguments, the following attributes are exported:
34+
35+
* `aliases`
36+
37+
* `name`
38+
39+
* `description`
40+
41+
* `direct_members_count`
42+
43+
* `admin_created`
44+
45+
* `non_editable_aliases`
46+
47+
* `member` - Lists the set of members in this group.

0 commit comments

Comments
 (0)