Skip to content

Commit

Permalink
mastodon implimentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tedivm committed Sep 21, 2024
1 parent c1d33fb commit ae63cb2
Show file tree
Hide file tree
Showing 27 changed files with 839 additions and 626 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

5 changes: 0 additions & 5 deletions .github/CODE_OF_CONDUCT.md

This file was deleted.

3 changes: 0 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ updates:
directory: "/"
schedule:
interval: "daily"
# TODO: Dependabot only updates hashicorp GHAs in the template repository, the following lines can be removed for consumers of this template
allow:
- dependency-name: "hashicorp/*"
27 changes: 16 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ name: Tests
on:
pull_request:
paths-ignore:
- 'README.md'
- "README.md"
push:
paths-ignore:
- 'README.md'
- "README.md"

# Testing only needs permissions to read the repository contents.
permissions:
Expand All @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
go-version-file: "go.mod"
cache: true
- run: go mod download
- run: go build -v .
Expand All @@ -40,13 +40,13 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
go-version-file: "go.mod"
cache: true
# Temporarily download Terraform 1.8 prerelease for function documentation support.
# When Terraform 1.8.0 final is released, this can be removed.
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
with:
terraform_version: '1.8.0-alpha20240216'
terraform_version: "1.8.0-alpha20240216"
terraform_wrapper: false
- run: go generate ./...
- name: git diff
Expand All @@ -65,16 +65,21 @@ jobs:
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '1.0.*'
- '1.1.*'
- '1.2.*'
- '1.3.*'
- '1.4.*'
- "1.0.*"
- "1.1.*"
- "1.2.*"
- "1.3.*"
- "1.4.*"
- "1.5.*"
- "1.6.*"
- "1.7.*"
- "1.8.*"
- "1.9.*"
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
go-version-file: "go.mod"
cache: true
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ website/vendor

# Keep windows files with windows line endings
*.winfile eol=crlf

.env
65 changes: 2 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,3 @@
# Terraform Provider Scaffolding (Terraform Plugin Framework)
# Terraform Mastodon Provider

_This template repository is built on the [Terraform Plugin Framework](https://github.com/hashicorp/terraform-plugin-framework). The template repository built on the [Terraform Plugin SDK](https://github.com/hashicorp/terraform-plugin-sdk) can be found at [terraform-provider-scaffolding](https://github.com/hashicorp/terraform-provider-scaffolding). See [Which SDK Should I Use?](https://developer.hashicorp.com/terraform/plugin/framework-benefits) in the Terraform documentation for additional information._

This repository is a *template* for a [Terraform](https://www.terraform.io) provider. It is intended as a starting point for creating Terraform providers, containing:

- A resource and a data source (`internal/provider/`),
- Examples (`examples/`) and generated documentation (`docs/`),
- Miscellaneous meta files.

These files contain boilerplate code that you will need to edit to create your own Terraform provider. Tutorials for creating Terraform providers can be found on the [HashiCorp Developer](https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework) platform. _Terraform Plugin Framework specific guides are titled accordingly._

Please see the [GitHub template repository documentation](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template) for how to create a new repository from this template on GitHub.

Once you've written your provider, you'll want to [publish it on the Terraform Registry](https://developer.hashicorp.com/terraform/registry/providers/publishing) so that others can use it.

## Requirements

- [Terraform](https://developer.hashicorp.com/terraform/downloads) >= 1.0
- [Go](https://golang.org/doc/install) >= 1.21

## Building The Provider

1. Clone the repository
1. Enter the repository directory
1. Build the provider using the Go `install` command:

```shell
go install
```

## Adding Dependencies

This provider uses [Go modules](https://github.com/golang/go/wiki/Modules).
Please see the Go documentation for the most up to date information about using Go modules.

To add a new dependency `github.com/author/dependency` to your Terraform provider:

```shell
go get github.com/author/dependency
go mod tidy
```

Then commit the changes to `go.mod` and `go.sum`.

## Using the provider

Fill this in for each provider

## Developing the Provider

If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (see [Requirements](#requirements) above).

To compile the provider, run `go install`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.

To generate or update documentation, run `go generate`.

In order to run the full suite of Acceptance tests, run `make testacc`.

*Note:* Acceptance tests create real resources, and often cost money to run.

```shell
make testacc
```
This provider was built as an example for [Terraform in Depth](https://mng.bz/QR21). It was build using the [Terraform Provider Scaffolding Framework](https://github.com/hashicorp/terraform-provider-scaffolding-framework).
34 changes: 34 additions & 0 deletions docs/data-sources/account.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "mastodon_account Data Source - mastodon"
subcategory: ""
description: |-
Account data source
---

# mastodon_account (Data Source)

Account data source

## Example Usage

```terraform
data "mastodon_account" "example" {
username = "@[email protected]"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `username` (String) Account configurable attribute

### Read-Only

- `bot` (Boolean)
- `display_name` (String)
- `id` (String) Account identifier
- `locked` (Boolean)
- `note` (String)
30 changes: 0 additions & 30 deletions docs/data-sources/example.md

This file was deleted.

26 changes: 0 additions & 26 deletions docs/functions/example.md

This file was deleted.

11 changes: 8 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "scaffolding Provider"
page_title: "mastodon Provider"
subcategory: ""
description: |-
---

# scaffolding Provider
# mastodon Provider



Expand All @@ -23,4 +23,9 @@ provider "scaffolding" {

### Optional

- `endpoint` (String) Example provider attribute
- `access_token` (String, Sensitive, Deprecated) Password to use for connecting to the server.
- `client_id` (String) Client ID for Mastodon App.
- `client_secret` (String) 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.
31 changes: 0 additions & 31 deletions docs/resources/example.md

This file was deleted.

31 changes: 31 additions & 0 deletions docs/resources/post.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "mastodon_post Resource - mastodon"
subcategory: ""
description: |-
Post resource
---

# mastodon_post (Resource)

Post resource



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `content` (String) Post content

### Optional

- `sensitive` (Boolean) Post sensitive
- `visibility` (String) Post visibility

### Read-Only

- `account` (String) Account that created the post
- `created_at` (String) Post creation timestamp
- `id` (String) Post identifier
3 changes: 3 additions & 0 deletions examples/data-sources/mastodon_account/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "mastodon_account" "example" {
username = "@[email protected]"
}
3 changes: 0 additions & 3 deletions examples/data-sources/scaffolding_example/data-source.tf

This file was deleted.

Loading

0 comments on commit ae63cb2

Please sign in to comment.