Skip to content

Commit 41ab758

Browse files
committed
docs: Generate with tfplugindocs
1 parent 78a5cd8 commit 41ab758

File tree

17 files changed

+504
-139
lines changed

17 files changed

+504
-139
lines changed

.github/workflows/check.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Check
2+
3+
on:
4+
push: {}
5+
pull_request: {}
6+
7+
jobs:
8+
9+
go:
10+
name: Go
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Set up Go 1.x
14+
uses: actions/setup-go@v2
15+
with:
16+
go-version: ^1.13
17+
18+
- name: Check out code into the Go module directory
19+
uses: actions/checkout@v2
20+
21+
- name: Get dependencies
22+
run: |
23+
go get -v -t -d ./...
24+
if [ -f Gopkg.toml ]; then
25+
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
26+
dep ensure
27+
fi
28+
29+
- name: Build
30+
run: go build -v ./...
31+
32+
- name: Test
33+
run: go test -v ./...
34+
35+
- name: Format check
36+
run: |
37+
fmtdiff="$(gofmt -s -e -d .)"
38+
if [ -n "$fmtdiff" ]; then
39+
>&2 echo "$fmtdiff"
40+
exit 1
41+
fi
42+
43+
terraform:
44+
name: Terraform
45+
runs-on: ubuntu-latest
46+
defaults:
47+
run:
48+
shell: bash
49+
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v2
53+
54+
- name: Setup Terraform
55+
uses: hashicorp/setup-terraform@v1
56+
57+
- name: Terraformat
58+
run: terraform fmt -recursive examples
59+
60+
- name: Check docs updated
61+
run: |
62+
curl -L https://github.com/hashicorp/terraform-plugin-docs/releases/download/v0.4.0/tfplugindocs_0.4.0_linux_amd64.zip --output tfplugindocs.zip
63+
unzip tfplugindocs.zip tfplugindocs
64+
./tfplugindocs
65+
change="$(git diff)"
66+
if [ -n "$change" ]; then
67+
>&2 echo "$change"
68+
exit 1
69+
fi

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/dist/
1+
/terraform-provider-wireguard
2+
*.tfstate

docs/index.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
layout: ""
3+
page_title: "Provider: Mullvad"
4+
description: |-
5+
The WireGuard provider is used to handle WireGuard metadata.
6+
---
7+
8+
# WireGuard Provider
9+
10+
The WireGuard provider is used to handle WireGuard metadata.
11+
12+
## Example Usage
13+
14+
```terraform
15+
provider "wireguard" {
16+
}
17+
```
18+
19+
<!-- schema generated by tfplugindocs -->
20+
## Schema

docs/resources/asymmetric_key.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "wireguard_asymmetric_key Resource - terraform-provider-wireguard"
4+
subcategory: ""
5+
description: |-
6+
Provides a WireGuard asymmetric key resource. This can be used to create, read, and delete WireGuard keys in terraform state.
7+
---
8+
9+
# wireguard_asymmetric_key (Resource)
10+
11+
Provides a WireGuard asymmetric key resource. This can be used to create, read, and delete WireGuard keys in terraform state.
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "wireguard_asymmetric_key" "example" {
17+
}
18+
19+
output "wg_public_key" {
20+
description = "Example's public WireGuard key"
21+
value = wireguard_asymmetric_key.example.public_key
22+
}
23+
24+
output "wg_private_key" {
25+
description = "Example's private WireGuard key"
26+
value = wireguard_asymmetric_key.example.private_key
27+
sensitive = true
28+
}
29+
```
30+
31+
<!-- schema generated by tfplugindocs -->
32+
## Schema
33+
34+
### Optional
35+
36+
- **bind** (String) A string to tie the lifecycle to, e.g. the terraform ID of another resource.
37+
- **id** (String) The ID of this resource.
38+
- **private_key** (String, Sensitive) A supplied WireGuard private key. By default one is generated.
39+
40+
### Read-Only
41+
42+
- **public_key** (String) The public key corresponding to the (given or generated) private key.
43+
44+

examples/asymmetric_key/main.tf

-5
This file was deleted.

examples/asymmetric_key/variables.tf

Whitespace-only changes.

examples/provider/provider.tf

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
provider "wireguard" {
2+
}

examples/asymmetric_key/outputs.tf examples/resources/wireguard_asymmetric_key/resource.tf

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
resource "wireguard_asymmetric_key" "example" {
2+
}
3+
14
output "wg_public_key" {
25
description = "Example's public WireGuard key"
36
value = wireguard_asymmetric_key.example.public_key

examples/asymmetric_key/versions.tf examples/resources/wireguard_asymmetric_key/versions.tf

-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ terraform {
44
source = "OJFord/wireguard"
55
}
66
}
7-
required_version = ">= 0.13"
87
}

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module github.com/OJFord/terraform-provider-wireguard
33
go 1.12
44

55
require (
6-
github.com/hashicorp/terraform-plugin-sdk v1.7.0
6+
github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.4
77
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200205215550-e35592f146e4
88
)

go.sum

+319-47
Large diffs are not rendered by default.

main.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package main
22

33
import (
4-
"github.com/OJFord/terraform-provider-wireguard/wireguard"
5-
"github.com/hashicorp/terraform-plugin-sdk/plugin"
6-
"github.com/hashicorp/terraform-plugin-sdk/terraform"
4+
"github.com/OJFord/terraform-provider-wireguard/provider"
5+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
6+
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
77
)
88

99
func main() {
1010
plugin.Serve(&plugin.ServeOpts{
11-
ProviderFunc: func() terraform.ResourceProvider {
12-
return wireguard.Provider()
11+
ProviderFunc: func() *schema.Provider {
12+
return provider.Provider()
1313
},
1414
})
1515
}

wireguard/provider.go provider/provider.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package wireguard
1+
package provider
22

33
import (
4-
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
4+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
55
)
66

77
func Provider() *schema.Provider {

wireguard/resource_wireguard_asymmetric_key.go provider/resource_wireguard_asymmetric_key.go

+21-16
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,38 @@
1-
package wireguard
1+
package provider
22

33
import (
4-
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
4+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
55
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
66
)
77

88
func resourceWireguardAsymmetricKey() *schema.Resource {
99
return &schema.Resource{
10+
Description: "Provides a WireGuard asymmetric key resource. This can be used to create, read, and delete WireGuard keys in terraform state.",
11+
1012
Create: resourceWireguardAsymmetricKeyCreate,
1113
Read: resourceWireguardAsymmetricKeyRead,
1214
Delete: resourceWireguardAsymmetricKeyDelete,
1315

1416
Schema: map[string]*schema.Schema{
15-
"bind": &schema.Schema{
16-
Default: "",
17-
ForceNew: true,
18-
Optional: true,
19-
Type: schema.TypeString,
17+
"bind": {
18+
Description: "A string to tie the lifecycle to, e.g. the terraform ID of another resource.",
19+
Default: "",
20+
ForceNew: true,
21+
Optional: true,
22+
Type: schema.TypeString,
2023
},
21-
"private_key": &schema.Schema{
22-
Computed: true,
23-
ForceNew: true,
24-
Optional: true,
25-
Sensitive: true,
26-
Type: schema.TypeString,
24+
"private_key": {
25+
Description: "A supplied WireGuard private key. By default one is generated.",
26+
Computed: true,
27+
ForceNew: true,
28+
Optional: true,
29+
Sensitive: true,
30+
Type: schema.TypeString,
2731
},
28-
"public_key": &schema.Schema{
29-
Computed: true,
30-
Type: schema.TypeString,
32+
"public_key": {
33+
Description: "The public key corresponding to the (given or generated) private key.",
34+
Computed: true,
35+
Type: schema.TypeString,
3136
},
3237
},
3338
}

templates/index.md.tmpl

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
layout: ""
3+
page_title: "Provider: Mullvad"
4+
description: |-
5+
The WireGuard provider is used to handle WireGuard metadata.
6+
---
7+
8+
# WireGuard Provider
9+
10+
The WireGuard provider is used to handle WireGuard metadata.
11+
12+
## Example Usage
13+
14+
{{ tffile "examples/provider/provider.tf" }}
15+
16+
{{ .SchemaMarkdown | trimspace }}

website/docs/index.html.markdown

-28
This file was deleted.

website/docs/r/asymmetric_key.html.markdown

-33
This file was deleted.

0 commit comments

Comments
 (0)