From 3464f7a120ecdd09ee196afd2d14e669ce772fb7 Mon Sep 17 00:00:00 2001 From: Ovais Tariq Date: Fri, 30 Aug 2024 11:00:54 -0700 Subject: [PATCH] Add documentation --- Makefile | 3 ++ README.md | 10 ++++++ docs/index.md | 22 +++++++++++++ docs/resources/bucket.md | 38 +++++++++++++++++++++ docs/resources/bucket_public_access.md | 40 ++++++++++++++++++++++ docs/resources/bucket_shadow_config.md | 44 +++++++++++++++++++++++++ docs/resources/bucket_website_config.md | 39 ++++++++++++++++++++++ scripts/generate-docs.sh | 19 +++++++++++ 8 files changed, 215 insertions(+) create mode 100644 docs/index.md create mode 100644 docs/resources/bucket.md create mode 100644 docs/resources/bucket_public_access.md create mode 100644 docs/resources/bucket_shadow_config.md create mode 100644 docs/resources/bucket_website_config.md create mode 100755 scripts/generate-docs.sh diff --git a/Makefile b/Makefile index e0f4fd0..1c6c915 100644 --- a/Makefile +++ b/Makefile @@ -63,4 +63,7 @@ tools: @echo "==> Installing development tooling..." go generate -tags tools tools/tools.go +docs: tools + @sh -c "'$(CURDIR)/scripts/generate-docs.sh'" + .PHONY: build install lint terraform-provider-lint vet fmt golangci-lint tools \ No newline at end of file diff --git a/README.md b/README.md index 35d4ebf..958d8b1 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,16 @@ resource "tigris_bucket_shadow_config" "example_shadow_config" { } ``` +## Developing + +### Documentation + +The documentation for this provider is generated using terraform-plugin-docs. To generate the documentation, run the following command: + +```shell +make docs +``` + ## Contributing Contributions are welcome! Please feel free to submit a Pull Request. diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..ff600da --- /dev/null +++ b/docs/index.md @@ -0,0 +1,22 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "tigris Provider" +subcategory: "" +description: |- + +--- + +# tigris Provider + + + + + + +## Schema + +### Optional + +- `access_key` (String) The access key. It can also be sourced from the AWS_ACCESS_KEY_ID environment variable. +- `endpoint` (String) The endpoint for the Tigris object storage service. +- `secret_key` (String, Sensitive) The secret key. It can also be sourced from the AWS_SECRET_ACCESS_KEY environment variable. diff --git a/docs/resources/bucket.md b/docs/resources/bucket.md new file mode 100644 index 0000000..585c529 --- /dev/null +++ b/docs/resources/bucket.md @@ -0,0 +1,38 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "tigris_bucket Resource - terraform-provider-tigris" +subcategory: "" +description: |- + Provides a Tigris bucket resource. This can be used to create and manage Tigris buckets. +--- + +# tigris_bucket (Resource) + +Provides a Tigris bucket resource. This can be used to create and manage Tigris buckets. + + + + +## Schema + +### Required + +- `bucket` (String) The name of the Tigris bucket. + +### Optional + +- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `timeouts` + +Optional: + +- `create` (String) +- `delete` (String) +- `read` (String) +- `update` (String) diff --git a/docs/resources/bucket_public_access.md b/docs/resources/bucket_public_access.md new file mode 100644 index 0000000..2539681 --- /dev/null +++ b/docs/resources/bucket_public_access.md @@ -0,0 +1,40 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "tigris_bucket_public_access Resource - terraform-provider-tigris" +subcategory: "" +description: |- + Provides a Tigris bucket resource. This can be used to create and manage Tigris buckets. +--- + +# tigris_bucket_public_access (Resource) + +Provides a Tigris bucket resource. This can be used to create and manage Tigris buckets. + + + + +## Schema + +### Required + +- `bucket` (String) The name of the Tigris bucket. + +### Optional + +- `acl` (String) The canned ACL to apply to the bucket. +- `public_list_objects` (Boolean) Whether to allow public listing of objects in the bucket. +- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `timeouts` + +Optional: + +- `create` (String) +- `delete` (String) +- `read` (String) +- `update` (String) diff --git a/docs/resources/bucket_shadow_config.md b/docs/resources/bucket_shadow_config.md new file mode 100644 index 0000000..6185116 --- /dev/null +++ b/docs/resources/bucket_shadow_config.md @@ -0,0 +1,44 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "tigris_bucket_shadow_config Resource - terraform-provider-tigris" +subcategory: "" +description: |- + Provides a Tigris bucket shadow configuration resource. +--- + +# tigris_bucket_shadow_config (Resource) + +Provides a Tigris bucket shadow configuration resource. + + + + +## Schema + +### Required + +- `bucket` (String) The name of the Tigris bucket. +- `shadow_access_key` (String, Sensitive) The access key for the shadow bucket. +- `shadow_bucket` (String) The name of the shadow bucket. +- `shadow_secret_key` (String, Sensitive) The secret key for the shadow bucket. + +### Optional + +- `shadow_endpoint` (String) The endpoint for the shadow bucket. +- `shadow_region` (String) The region for the shadow bucket. +- `shadow_write_through` (Boolean) Whether to write through to the shadow bucket. +- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `timeouts` + +Optional: + +- `create` (String) +- `delete` (String) +- `read` (String) +- `update` (String) diff --git a/docs/resources/bucket_website_config.md b/docs/resources/bucket_website_config.md new file mode 100644 index 0000000..fee286f --- /dev/null +++ b/docs/resources/bucket_website_config.md @@ -0,0 +1,39 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "tigris_bucket_website_config Resource - terraform-provider-tigris" +subcategory: "" +description: |- + Provides a Tigris bucket website configuration resource. +--- + +# tigris_bucket_website_config (Resource) + +Provides a Tigris bucket website configuration resource. + + + + +## Schema + +### Required + +- `bucket` (String) The name of the Tigris bucket. + +### Optional + +- `domain_name` (String) The custom domain name to apply to the bucket. +- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `timeouts` + +Optional: + +- `create` (String) +- `delete` (String) +- `read` (String) +- `update` (String) diff --git a/scripts/generate-docs.sh b/scripts/generate-docs.sh new file mode 100755 index 0000000..5636be9 --- /dev/null +++ b/scripts/generate-docs.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# +# Generate the documentation using tfplugindocs and remove changes to files that +# shouldn't change + +exclude_files=() + +# Check if manual changes were made to any excluded files and exit +# otherwise these will be lost with `tfplugindocs` +# if [ "$(git status --porcelain "${exclude_files[@]}")" ]; then +# echo "Uncommitted changes were detected to the following files. These aren't autogenerated, please commit or stash these changes and try again" +# echo $(git status --porcelain "${exclude_files[@]}") +# exit 1 +# fi + +tfplugindocs generate -rendered-provider-name "Tigris" + +# Remove the changes to files we don't autogenerate +git checkout HEAD -- "${exclude_files[@]}"