Skip to content

Commit 0a063ff

Browse files
committed
Add docs, goreleaser, and GH actions
1 parent 47475f7 commit 0a063ff

File tree

18 files changed

+367
-39
lines changed

18 files changed

+367
-39
lines changed

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Terraform Provider release workflow.
2+
name: Release
3+
4+
# This GitHub action creates a release when a tag that matches the pattern
5+
# "v*" (e.g. v0.1.0) is created.
6+
on:
7+
push:
8+
tags:
9+
- 'v*'
10+
11+
# Releases need permissions to read and write the repository contents.
12+
# GitHub considers creating releases and uploading assets as writing contents.
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
goreleaser:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
21+
with:
22+
# Allow goreleaser to access older tag information.
23+
fetch-depth: 0
24+
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
25+
with:
26+
go-version-file: 'go.mod'
27+
cache: true
28+
- name: Import GPG key
29+
uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549 # v5.2.0
30+
id: import_gpg
31+
with:
32+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
33+
passphrase: ${{ secrets.PASSPHRASE }}
34+
- name: Run GoReleaser
35+
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0
36+
with:
37+
args: release --clean
38+
env:
39+
# GitHub sets the GITHUB_TOKEN secret automatically.
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

.goreleaser.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
3+
before:
4+
hooks:
5+
# this is just an example and not a requirement for provider building/publishing
6+
- go mod tidy
7+
builds:
8+
- env:
9+
# goreleaser does not work with CGO, it could also complicate
10+
# usage by users in CI/CD systems like Terraform Cloud where
11+
# they are unable to install libraries.
12+
- CGO_ENABLED=0
13+
mod_timestamp: '{{ .CommitTimestamp }}'
14+
flags:
15+
- -trimpath
16+
ldflags:
17+
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
18+
goos:
19+
- freebsd
20+
- windows
21+
- linux
22+
- darwin
23+
goarch:
24+
- amd64
25+
- '386'
26+
- arm
27+
- arm64
28+
ignore:
29+
- goos: darwin
30+
goarch: '386'
31+
binary: '{{ .ProjectName }}_v{{ .Version }}'
32+
archives:
33+
- format: zip
34+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
35+
checksum:
36+
extra_files:
37+
- glob: 'terraform-registry-manifest.json'
38+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
39+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
40+
algorithm: sha256
41+
signs:
42+
- artifacts: checksum
43+
args:
44+
# if you are using this in a GitHub action or some other automated pipeline, you
45+
# need to pass the batch flag to indicate its not interactive.
46+
- "--batch"
47+
- "--local-user"
48+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
49+
- "--output"
50+
- "${signature}"
51+
- "--detach-sign"
52+
- "${artifact}"
53+
release:
54+
extra_files:
55+
- glob: 'terraform-registry-manifest.json'
56+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
57+
# If you want to manually examine the release before its live, uncomment this line:
58+
# draft: true
59+
changelog:
60+
skip: true

docs/index.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "hostingde Provider"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# hostingde Provider
10+
11+
12+
13+
## Example Usage
14+
15+
```terraform
16+
# Configuration-based authentication
17+
# This is not recommended, use environment variables to configure the provider:
18+
# HOSTINGDE_AUTH_TOKEN, (Optional: HOSTINGDE_ACCOUNT_ID)
19+
# Can be omitted when using the environment variables
20+
21+
provider "hostingde" {
22+
auth_token = "YOUR_API_TOKEN"
23+
account_id = "YOUR_ACCOUNT_ID"
24+
}
25+
```
26+
27+
<!-- schema generated by tfplugindocs -->
28+
## Schema
29+
30+
### Optional
31+
32+
- `account_id` (String) Account ID for hosting.de API. May also be provided via HOSTINGDE_ACCOUNT_ID environment variable.
33+
- `auth_token` (String, Sensitive) Auth token for hosting.de API. May also be provided via HOSTINGDE_AUTH_TOKEN environment variable.

docs/resources/record.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "hostingde_record Resource - hostingde"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# hostingde_record (Resource)
10+
11+
12+
13+
## Example Usage
14+
15+
```terraform
16+
# Manage example DNS record.
17+
resource "hostingde_record" "example" {
18+
zone_id = hostingde_zone.sample.id
19+
name = "test.example.test"
20+
type = "CNAME"
21+
content = "www.example.com"
22+
}
23+
```
24+
25+
<!-- schema generated by tfplugindocs -->
26+
## Schema
27+
28+
### Required
29+
30+
- `content` (String) Content of the DNS record.
31+
- `name` (String) Name of the record. Example: mail.example.com.
32+
- `type` (String) Type of the DNS record. Valid types are A, AAAA, ALIAS, CAA, CERT, CNAME, DNSKEY, DS, MX, NS, NSEC, NSEC3, NSEC3PARAM, NULLMX, OPENPGPKEY, PTR, RRSIG, SRV, SSHFP, TLSA, and TXT.
33+
- `zone_id` (String) ID of DNS zone that the record belongs to.
34+
35+
### Optional
36+
37+
- `ttl` (Number) TTL of the DNS record in seconds.
38+
39+
### Read-Only
40+
41+
- `id` (String) DNS record ID
42+
43+
## Import
44+
45+
Import is supported using the following syntax:
46+
47+
```shell
48+
# DNS record can be imported by specifying the record id.
49+
# See the README for details how to get the record id.
50+
terraform import hostingde_record.example $RECORD_ID
51+
```

docs/resources/zone.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "hostingde_zone Resource - hostingde"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# hostingde_zone (Resource)
10+
11+
12+
13+
## Example Usage
14+
15+
```terraform
16+
# Manage example DNS zone.
17+
resource "hostingde_zone" "sample" {
18+
name = "example.test"
19+
type = "NATIVE"
20+
}
21+
```
22+
23+
<!-- schema generated by tfplugindocs -->
24+
## Schema
25+
26+
### Required
27+
28+
- `name` (String) Domain name (top-level domain) of the zone.
29+
- `type` (String) The zone type. Valid types are NATIVE, MASTER, and SLAVE. Changing this forces re-creation of the zone.
30+
31+
### Optional
32+
33+
- `email` (String) The hostmaster email address. Only relevant if the type is NATIVE or MASTER. If the field is left empty, the default is hostmaster@name.
34+
35+
### Read-Only
36+
37+
- `id` (String) Numeric identifier of the zone.
38+
39+
## Import
40+
41+
Import is supported using the following syntax:
42+
43+
```shell
44+
# DNS zone can be imported by specifying the zone id.
45+
terraform import hostingde_zone.example 171029aw8802239
46+
```

examples/provider/provider.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Configuration-based authentication
2+
# This is not recommended, use environment variables to configure the provider:
3+
# HOSTINGDE_AUTH_TOKEN, (Optional: HOSTINGDE_ACCOUNT_ID)
4+
# Can be omitted when using the environment variables
5+
6+
provider "hostingde" {
7+
auth_token = "YOUR_API_TOKEN"
8+
account_id = "YOUR_ACCOUNT_ID"
9+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# DNS record can be imported by specifying the record id.
2+
# See the README for details how to get the record id.
3+
terraform import hostingde_record.example $RECORD_ID
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Manage example DNS record.
2+
resource "hostingde_record" "example" {
3+
zone_id = hostingde_zone.sample.id
4+
name = "test.example.test"
5+
type = "CNAME"
6+
content = "www.example.com"
7+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# DNS zone can be imported by specifying the zone id.
2+
terraform import hostingde_zone.example 171029aw8802239
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Manage example DNS zone.
2+
resource "hostingde_zone" "sample" {
3+
name = "example.test"
4+
type = "NATIVE"
5+
}

go.mod

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,26 @@ go 1.18
44

55
require (
66
github.com/cenkalti/backoff/v4 v4.2.0
7+
github.com/hashicorp/terraform-plugin-docs v0.14.1
78
github.com/hashicorp/terraform-plugin-framework v1.2.0
89
github.com/hashicorp/terraform-plugin-go v0.14.3
910
github.com/hashicorp/terraform-plugin-log v0.8.0
1011
github.com/hashicorp/terraform-plugin-testing v1.1.0
1112
)
1213

1314
require (
15+
github.com/Masterminds/goutils v1.1.1 // indirect
16+
github.com/Masterminds/semver/v3 v3.1.1 // indirect
17+
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
1418
github.com/agext/levenshtein v1.2.2 // indirect
1519
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
20+
github.com/armon/go-radix v1.0.0 // indirect
21+
github.com/bgentry/speakeasy v0.1.0 // indirect
1622
github.com/fatih/color v1.13.0 // indirect
1723
github.com/golang/protobuf v1.5.2 // indirect
1824
github.com/google/go-cmp v0.5.9 // indirect
19-
github.com/hashicorp/errwrap v1.0.0 // indirect
25+
github.com/google/uuid v1.3.0 // indirect
26+
github.com/hashicorp/errwrap v1.1.0 // indirect
2027
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
2128
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
2229
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
@@ -28,29 +35,36 @@ require (
2835
github.com/hashicorp/hc-install v0.5.0 // indirect
2936
github.com/hashicorp/hcl/v2 v2.16.0 // indirect
3037
github.com/hashicorp/logutils v1.0.0 // indirect
31-
github.com/hashicorp/terraform-exec v0.17.3 // indirect
32-
github.com/hashicorp/terraform-json v0.14.0 // indirect
38+
github.com/hashicorp/terraform-exec v0.18.1 // indirect
39+
github.com/hashicorp/terraform-json v0.15.0 // indirect
3340
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1 // indirect
3441
github.com/hashicorp/terraform-registry-address v0.1.0 // indirect
3542
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
3643
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
37-
github.com/mattn/go-colorable v0.1.12 // indirect
38-
github.com/mattn/go-isatty v0.0.14 // indirect
44+
github.com/huandu/xstrings v1.3.2 // indirect
45+
github.com/imdario/mergo v0.3.13 // indirect
46+
github.com/mattn/go-colorable v0.1.13 // indirect
47+
github.com/mattn/go-isatty v0.0.16 // indirect
48+
github.com/mitchellh/cli v1.1.5 // indirect
3949
github.com/mitchellh/copystructure v1.2.0 // indirect
4050
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
4151
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
4252
github.com/mitchellh/mapstructure v1.5.0 // indirect
4353
github.com/mitchellh/reflectwalk v1.0.2 // indirect
4454
github.com/oklog/run v1.0.0 // indirect
55+
github.com/posener/complete v1.2.3 // indirect
56+
github.com/russross/blackfriday v1.6.0 // indirect
57+
github.com/shopspring/decimal v1.3.1 // indirect
58+
github.com/spf13/cast v1.5.0 // indirect
4559
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
4660
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
4761
github.com/vmihailenco/tagparser v0.1.1 // indirect
48-
github.com/zclconf/go-cty v1.12.1 // indirect
62+
github.com/zclconf/go-cty v1.13.0 // indirect
4963
golang.org/x/crypto v0.5.0 // indirect
5064
golang.org/x/mod v0.7.0 // indirect
5165
golang.org/x/net v0.5.0 // indirect
5266
golang.org/x/sys v0.4.0 // indirect
53-
golang.org/x/text v0.6.0 // indirect
67+
golang.org/x/text v0.7.0 // indirect
5468
google.golang.org/appengine v1.6.6 // indirect
5569
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect
5670
google.golang.org/grpc v1.51.0 // indirect

0 commit comments

Comments
 (0)