-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use env variable for version * add templates for registry release * update deps and use tf sdk v2 instead * use gsm v0.2.6's built-in feature to wait until drive is ready * add drive restrictions * add possible restrictions to example drive * update version in example * draft release * dont run go mod tidy * fix description * add data types * add setting to retry on specific HTTP errors * remove a few comments * add docs * update example * use go 1.16 * fix some lint issues * add report card badge * update dep
- Loading branch information
1 parent
ba5cf0e
commit 91c6173
Showing
23 changed files
with
841 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# This GitHub action can publish assets for release when a tag is created. | ||
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0). | ||
# | ||
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your | ||
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE` | ||
# secret. If you would rather own your own GPG handling, please fork this action | ||
# or use an alternative one for key handling. | ||
# | ||
# You will need to pass the `--batch` flag to `gpg` in your signing step | ||
# in `goreleaser` to indicate this is being used in a non-interactive mode. | ||
# | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16 | ||
- name: Import GPG key | ||
id: import_gpg | ||
uses: hashicorp/[email protected] | ||
env: | ||
# These secrets will need to be configured for the repository: | ||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
PASSPHRASE: ${{ secrets.PASSPHRASE }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | ||
# GitHub sets this automatically | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Visit https://goreleaser.com for documentation on how to customize this | ||
# behavior. | ||
before: | ||
hooks: | ||
# this is just an example and not a requirement for provider building/publishing | ||
# - go mod tidy | ||
builds: | ||
- env: | ||
# goreleaser does not work with CGO, it could also complicate | ||
# usage by users in CI/CD systems like Terraform Cloud where | ||
# they are unable to install libraries. | ||
- CGO_ENABLED=0 | ||
mod_timestamp: "{{ .CommitTimestamp }}" | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}" | ||
goos: | ||
- freebsd | ||
- windows | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- "386" | ||
- arm | ||
- arm64 | ||
ignore: | ||
- goos: darwin | ||
goarch: "386" | ||
binary: "{{ .ProjectName }}_v{{ .Version }}" | ||
archives: | ||
- format: zip | ||
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
checksum: | ||
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS" | ||
algorithm: sha256 | ||
signs: | ||
- artifacts: checksum | ||
args: | ||
# if you are using this in a GitHub action or some other automated pipeline, you | ||
# need to pass the batch flag to indicate its not interactive. | ||
- "--batch" | ||
- "--local-user" | ||
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key | ||
- "--output" | ||
- "${signature}" | ||
- "--detach-sign" | ||
- "${artifact}" | ||
release: | ||
# If you want to manually examine the release before its live, uncomment this line: | ||
draft: true | ||
changelog: | ||
skip: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "gdrive_drive Data Source - terraform-provider-gdrive" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# gdrive_drive (Data Source) | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- **drive_id** (String) ID of the Shared Drive | ||
|
||
### Optional | ||
|
||
- **id** (String) The ID of this resource. | ||
- **use_domain_admin_access** (Boolean) Use domain admin access | ||
|
||
### Read-Only | ||
|
||
- **name** (String) | ||
- **restrictions** (List of Object) (see [below for nested schema](#nestedatt--restrictions)) | ||
|
||
<a id="nestedatt--restrictions"></a> | ||
### Nested Schema for `restrictions` | ||
|
||
Read-Only: | ||
|
||
- **admin_managed_restrictions** (Boolean) | ||
- **copy_requires_writer_permission** (Boolean) | ||
- **domain_users_only** (Boolean) | ||
- **drive_members_only** (Boolean) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "gdrive_file Data Source - terraform-provider-gdrive" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# gdrive_file (Data Source) | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- **file_id** (String) ID of the file | ||
|
||
### Optional | ||
|
||
- **id** (String) The ID of this resource. | ||
|
||
### Read-Only | ||
|
||
- **drive_id** (String) | ||
- **mime_type** (String) | ||
- **name** (String) | ||
- **parent** (String) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "gdrive_permission Data Source - terraform-provider-gdrive" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# gdrive_permission (Data Source) | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- **file_id** (String) ID of the file or Shared Drive | ||
- **permission_id** (String) ID of the permission | ||
|
||
### Optional | ||
|
||
- **id** (String) The ID of this resource. | ||
- **use_domain_admin_access** (Boolean) Use domain admin access | ||
|
||
### Read-Only | ||
|
||
- **domain** (String) | ||
- **email_address** (String) | ||
- **role** (String) | ||
- **type** (String) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "gdrive Provider" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# gdrive Provider | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Optional | ||
|
||
- **retry_on** (List of Number) A list of HTTP error codes you want the provider to retry on (e.g. 404). | ||
- **service_account** (String) The email address of the Service Account you want to impersonate with Application Default Credentials (ADC). | ||
Leave empty if you want to use the Service Account of a GCE instance directly. | ||
- **service_account_key** (String) The path to a key file for your Service Account. | ||
Leave empty if you want to use Application Default Credentials (ADC). | ||
- **subject** (String) The email address of the Workspace user you want to impersonate with Domain Wide Delegation (DWD) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "gdrive_drive Resource - terraform-provider-gdrive" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# gdrive_drive (Resource) | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- **name** (String) Name of the Shared Drive | ||
|
||
### Optional | ||
|
||
- **id** (String) The ID of this resource. | ||
- **restrictions** (Block List, Max: 1) (see [below for nested schema](#nestedblock--restrictions)) | ||
- **use_domain_admin_access** (Boolean) Use domain admin access | ||
|
||
<a id="nestedblock--restrictions"></a> | ||
### Nested Schema for `restrictions` | ||
|
||
Optional: | ||
|
||
- **admin_managed_restrictions** (Boolean) Whether administrative privileges on this shared drive are required to modify restrictions | ||
- **copy_requires_writer_permission** (Boolean) Whether the options to copy, print, or download files inside this shared drive, should be disabled for readers and commenters. | ||
When this restriction is set to true, it will override the similarly named field to true for any file inside this shared drive | ||
- **domain_users_only** (Boolean) Whether access to this shared drive and items inside this shared drive is restricted to users of the domain to which this shared drive belongs. | ||
This restriction may be overridden by other sharing policies controlled outside of this shared drive | ||
- **drive_members_only** (Boolean) Whether access to items inside this shared drive is restricted to its members | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "gdrive_file Resource - terraform-provider-gdrive" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# gdrive_file (Resource) | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- **mime_type** (String) MIME type | ||
- **name** (String) name of the file / folder | ||
- **parent** (String) fileId of the parent | ||
|
||
### Optional | ||
|
||
- **content** (String) path to a file to upload | ||
- **drive_id** (String) driveId of the Shared Drive | ||
- **id** (String) The ID of this resource. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "gdrive_permission Resource - terraform-provider-gdrive" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# gdrive_permission (Resource) | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- **file_id** (String) ID of the file or Shared Drive | ||
- **role** (String) The role | ||
- **type** (String) The type of the trustee. Can be 'user', 'domain', 'group' or 'anyone' | ||
|
||
### Optional | ||
|
||
- **domain** (String) The domain that should be granted access | ||
- **email_address** (String) The email address of the trustee | ||
- **email_message** (String) An optional email message that will be sent when the permission is created | ||
- **id** (String) The ID of this resource. | ||
- **send_notification_email** (Boolean) Wether to send a notfication email | ||
- **use_domain_admin_access** (Boolean) Use domain admin access | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ terraform { | |
required_providers { | ||
gdrive = { | ||
source = "github.com/hanneshayashi/gdrive" | ||
version = "0.2.0" | ||
version = "0.3.0" | ||
} | ||
} | ||
} | ||
|
@@ -11,10 +11,18 @@ provider "gdrive" { | |
service_account_key = "/path/to/sa.json" # This is the Key file for your Service Account | ||
# service_account = "[email protected]" # This is the email address of your Service Account. You can leave this empty on GCE, if you want to use the instance's account | ||
subject = "[email protected]" # This is the user you want to impersonate with Domain Wide Delegation | ||
# retry_on = [ 404 ] # Retry on specific HTTP error codes such as 404 | ||
} | ||
|
||
resource "gdrive_drive" "example_drive" { | ||
name = "terraform-1" | ||
|
||
# restrictions { | ||
# admin_managed_restrictions = true | ||
# drive_members_only = true | ||
# copy_requires_writer_permission = true | ||
# domain_users_only = true | ||
# } | ||
} | ||
|
||
resource "gdrive_file" "folder_1" { | ||
|
Oops, something went wrong.