Skip to content

Commit

Permalink
Merge pull request #5 from jkroepke/terraform-registry-manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
jkroepke authored May 25, 2024
2 parents b11fca7 + 3585b72 commit fd30472
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 120 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
# Terraform Provider testing workflow.
name: Tests

# This GitHub action runs your tests for each pull request and push.
# Optionally, you can turn it on using a schedule for regular testing.
on:
workflow_dispatch:

pull_request:
paths-ignore:
- 'README.md'
push:
paths-ignore:
- 'README.md'

# Testing only needs permissions to read the repository contents.
permissions:
contents: read

jobs:
# Ensure project builds before running testing matrix
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
with:
version: latest
args: --issues-exit-code=0 #TODO: remove this line when all issues are fixed

generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
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_wrapper: false
- run: go generate ./...
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
# Run acceptance tests in a matrix with Terraform CLI versions
test:
name: Terraform Provider Acceptance Tests
needs: build
if: "false"
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '1.0.*'
- '1.1.*'
- '1.2.*'
- '1.3.*'
- '1.4.*'
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod download
- env:
TF_ACC: "1"
HETZNER_DNS_API_TOKEN: ${{ secrets.HETZNER_DNS_API_TOKEN }}
run: go test -v -cover ./internal/provider/
timeout-minutes: 10
22 changes: 0 additions & 22 deletions .github/workflows/lint-test-build.yaml

This file was deleted.

27 changes: 27 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Visit https://golangci-lint.run/ for usage documentation
# and information on other useful linters
issues:
max-per-linter: 0
max-same-issues: 0

linters:
disable-all: true
enable:
- durationcheck
- errcheck
- exportloopref
- forcetypeassert
- godot
- gofmt
- gosimple
- ineffassign
- makezero
- misspell
- nilerr
- predeclared
- staticcheck
- tenv
- unconvert
- unparam
- unused
- vet
76 changes: 0 additions & 76 deletions INSTALL.md

This file was deleted.

4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ there or [here](docs).

You most likely want to download the provider from [Terraform
Registry](https://registry.terraform.io/providers/germanbrew/hetznerdns/latest/docs).
If you want or need to install the provider locally, take a look at
[INSTALL](./INSTALL.md).

### Using Provider from Terraform Registry (TF >= 1.0)

Expand All @@ -47,7 +45,7 @@ Then run `terraform init` to download the provider.

## Authentication

Once installed you have three options to provide the required API token that
Once installed, you have three options to provide the required API token that
is used to authenticate at the Hetzner DNS API.

### Enter API Token when needed
Expand Down
20 changes: 1 addition & 19 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,10 @@ A release of this provider includes publishing the new version
at the Terraform registry. Therefore, a file containing hashes
of the binaries must be singed with my private GPG key.

First create a new tag and push it to GitHub. This starts a
workflow which drafts a release.
Create a new tag and push it to GitHub. This starts a workflow that creates a release.

```bash
$ git tag v1.0.17
$ git push --tags
```

Then navigate your browser to the GitHub [releases page of this repository](https://github.com/germanbrew/terraform-provider-hetznerdns/releases).

Download `terraform-provider-hetznerdns_1.0.17_SHA256SUMS` from the
list of assets associated with this release. The version might by
different.

Now create a signature file using gpg.

```bash
$ gpg --detach-sign ./terraform-provider-hetznerdns_1.0.17_SHA256SUMS
```

This create another file `terraform-provider-hetznerdns_1.0.17_SHA256SUMS.sig`.
Add it to the assets of the current draft release.

Then publish the release. Terraform registry adds the new release automatically.

6 changes: 6 additions & 0 deletions terraform-registry-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": 1,
"metadata": {
"protocol_versions": ["5.0"]
}
}

0 comments on commit fd30472

Please sign in to comment.