Skip to content

Commit

Permalink
feat: configure provider and quotes data source (#1)
Browse files Browse the repository at this point in the history
* initial ds and provider setup

* additional cleanup

* check w.write

* declare + assign

* add test for 1.5 and add ID for tf1.0?

* regenerate docs
  • Loading branch information
anGie44 authored Sep 10, 2023
1 parent e224e9c commit cc97de6
Show file tree
Hide file tree
Showing 22 changed files with 554 additions and 508 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ jobs:
- '1.2.*'
- '1.3.*'
- '1.4.*'
- '1.5.*'

steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
Expand Down
19 changes: 3 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
# Terraform Provider Scaffolding (Terraform Plugin Framework)

_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.
# Terraform Provider theOffice

## Requirements

Expand Down Expand Up @@ -45,7 +31,8 @@ Then commit the changes to `go.mod` and `go.sum`.

## Using the provider

Fill this in for each provider
Refer to the documentation for provider configuration and
available data sources.

## Developing the Provider

Expand Down
47 changes: 47 additions & 0 deletions docs/data-sources/quotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "theoffice_quotes Data Source - terraform-provider-theoffice"
subcategory: ""
description: |-
Fetches a list of quotes
---

# theoffice_quotes (Data Source)

Fetches a list of quotes

## Example Usage

```terraform
data "theoffice_quotes" "example" {
season = 1
}
```

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

### Required

- `season` (Number) Season number to filter results by

### Optional

- `episode` (Number) Episode number to filter results by

### Read-Only

- `id` (String) Placeholder identifier attribute.
- `quotes` (Attributes List) List of quotes (see [below for nested schema](#nestedatt--quotes))

<a id="nestedatt--quotes"></a>
### Nested Schema for `quotes`

Read-Only:

- `character` (String) The character who said the quote.
- `episode` (Number) The episode the quote occurred in.
- `episode_name` (String) The name of the episode the quote occurred in.
- `quote` (String) The quote as a string
- `scene` (Number) The scene the quote occurred in.
- `season` (Number) The season the quote occurred in.
30 changes: 0 additions & 30 deletions docs/data-sources/scaffolding_example.md

This file was deleted.

14 changes: 6 additions & 8 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "scaffolding-framework Provider"
page_title: "theoffice Provider"
subcategory: ""
description: |-
Interact with theOffice API
---

# scaffolding-framework Provider

# theoffice Provider

Interact with theOffice API

## Example Usage

```terraform
provider "scaffolding" {
# example configuration here
}
provider "theoffice" {}
```

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

### Optional

- `endpoint` (String) Example provider attribute
- `endpoint` (String) The REST API endpoint to use for reading data (default: http://theofficeapi-angelinepinilla.b4a.run)
31 changes: 0 additions & 31 deletions docs/resources/scaffolding_example.md

This file was deleted.

3 changes: 0 additions & 3 deletions examples/data-sources/scaffolding_example/data-source.tf

This file was deleted.

3 changes: 3 additions & 0 deletions examples/data-sources/theoffice_quotes/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "theoffice_quotes" "example" {
season = 1
}
4 changes: 1 addition & 3 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
provider "scaffolding" {
# example configuration here
}
provider "theoffice" {}
11 changes: 8 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
module github.com/hashicorp/terraform-provider-scaffolding-framework
module github.com/anGie44/terraform-provider-theoffice

go 1.19
go 1.20

require (
github.com/hashicorp/go-hclog v1.5.0
github.com/hashicorp/go-retryablehttp v0.7.4
github.com/hashicorp/terraform-plugin-docs v0.16.0
github.com/hashicorp/terraform-plugin-framework v1.4.0
github.com/hashicorp/terraform-plugin-go v0.19.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-testing v1.5.1
github.com/stretchr/testify v1.7.2
)

require (
Expand All @@ -20,6 +23,7 @@ require (
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
Expand All @@ -28,7 +32,6 @@ require (
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.5.1 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
Expand All @@ -53,6 +56,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/posener/complete v1.2.3 // indirect
github.com/russross/blackfriday v1.6.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
Expand All @@ -71,4 +75,5 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,16 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI=
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c=
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/go-plugin v1.5.1 h1:oGm7cWBaYIp3lJpx1RUEfLWophprE2EV/KUeqBYo+6k=
github.com/hashicorp/go-plugin v1.5.1/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4=
github.com/hashicorp/go-retryablehttp v0.7.4 h1:ZQgVdpTdAL7WpMIwLzCfbalOcSUdkDZnpUv3/+BxzFA=
github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
Expand Down
105 changes: 0 additions & 105 deletions internal/provider/example_data_source.go

This file was deleted.

Loading

0 comments on commit cc97de6

Please sign in to comment.