diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 991d782..d0187d5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,8 @@ on: push: paths-ignore: - "README.md" + branches: + - main # Testing only needs permissions to read the repository contents. permissions: diff --git a/docs/index.md b/docs/index.md index 681802f..4d719ac 100644 --- a/docs/index.md +++ b/docs/index.md @@ -6,7 +6,7 @@ description: |- --- -# mastodon Provider +# Mastodon Provider @@ -16,6 +16,10 @@ description: |- provider "mastodon" { host = "https://mastodon.social" } + +resource "mastodon_post" "example" { + content = "I'm posting to the Fediverse from Terraform!" +} ``` <!-- schema generated by tfplugindocs --> @@ -23,9 +27,9 @@ provider "mastodon" { ### Optional -- `access_token` (String, Sensitive) Password to use for connecting to the server. -- `client_id` (String) Client ID for Mastodon App. -- `client_secret` (String, Sensitive) Client Secret for Mastodon App. -- `email` (String) Username to connect to the server as. -- `host` (String) Mastodon host to connect to. -- `password` (String, Sensitive) Password to use for connecting to the server. +- `access_token` (String, Sensitive) Password to use for connecting to the server. Can be designated by the `MASTODON_ACCESS_TOKEN` environment variable. +- `client_id` (String) Client ID for Mastodon App. Can be designated by the `MASTODON_CLIENT_ID` environment variable. +- `client_secret` (String, Sensitive) Client Secret for Mastodon App. Can be designated by the `MASTODON_CLIENT_SECRET` environment variable. +- `email` (String) Username to connect to the server as. Can be designated by the `MASTODON_USER_EMAIL` environment variable. +- `host` (String) Mastodon host to connect to. Can be designated by the `MASTODON_HOST` environment variable. +- `password` (String, Sensitive) Password to use for connecting to the server. Can be designated by the `MASTODON_USER_PASSWORD` environment variable. diff --git a/docs/resources/post.md b/docs/resources/post.md index e9ab900..18458cf 100644 --- a/docs/resources/post.md +++ b/docs/resources/post.md @@ -14,7 +14,7 @@ This resource is used to manage posts on a Mastodon instance. ```terraform resource "mastodon_post" "example" { - content = "I'm posting!" + content = "What a great day to post to the Fediverse from Terraform!" } ``` diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 4107a8b..3157235 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -1,3 +1,7 @@ provider "mastodon" { host = "https://mastodon.social" } + +resource "mastodon_post" "example" { + content = "I'm posting to the Fediverse from Terraform!" +} diff --git a/examples/resources/mastodon_post/resource.tf b/examples/resources/mastodon_post/resource.tf index 919d739..a6546d6 100644 --- a/examples/resources/mastodon_post/resource.tf +++ b/examples/resources/mastodon_post/resource.tf @@ -1,3 +1,3 @@ resource "mastodon_post" "example" { - content = "I'm posting!" + content = "What a great day to post to the Fediverse from Terraform!" } diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 83f4fab..715e235 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -46,29 +46,29 @@ func (p *MastodonProvider) Schema(ctx context.Context, req provider.SchemaReques resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "host": schema.StringAttribute{ - MarkdownDescription: "Mastodon host to connect to.", + MarkdownDescription: "Mastodon host to connect to. Can be designated by the `MASTODON_HOST` environment variable.", Optional: true, }, "client_id": schema.StringAttribute{ - MarkdownDescription: "Client ID for Mastodon App.", + MarkdownDescription: "Client ID for Mastodon App. Can be designated by the `MASTODON_CLIENT_ID` environment variable.", Optional: true, }, "client_secret": schema.StringAttribute{ - MarkdownDescription: "Client Secret for Mastodon App.", + MarkdownDescription: "Client Secret for Mastodon App. Can be designated by the `MASTODON_CLIENT_SECRET` environment variable.", Optional: true, Sensitive: true, }, "email": schema.StringAttribute{ - MarkdownDescription: "Username to connect to the server as.", + MarkdownDescription: "Username to connect to the server as. Can be designated by the `MASTODON_USER_EMAIL` environment variable.", Optional: true, }, "password": schema.StringAttribute{ - MarkdownDescription: "Password to use for connecting to the server.", + MarkdownDescription: "Password to use for connecting to the server. Can be designated by the `MASTODON_USER_PASSWORD` environment variable.", Optional: true, Sensitive: true, }, "access_token": schema.StringAttribute{ - MarkdownDescription: "Password to use for connecting to the server.", + MarkdownDescription: "Password to use for connecting to the server. Can be designated by the `MASTODON_ACCESS_TOKEN` environment variable.", Optional: true, Sensitive: true, }, diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl new file mode 100644 index 0000000..77b54c5 --- /dev/null +++ b/templates/index.md.tmpl @@ -0,0 +1,19 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "{{.ProviderShortName}} Provider" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# Mastodon Provider + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }}