Merge pull request #55 from beatz174-bit/codex/prepare-terraform-provider-for-public-registry

Prepare provider for public Terraform Registry publishing
This commit is contained in:
beatz174-bit
2026-05-12 18:44:23 +10:00
committed by GitHub
32 changed files with 123 additions and 57 deletions
+15 -10
View File
@@ -1,9 +1,9 @@
name: release name: Release
on: on:
push: push:
tags: tags:
- 'v*' - "v*"
permissions: permissions:
contents: write contents: write
@@ -12,21 +12,26 @@ jobs:
goreleaser: goreleaser:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - uses: actions/checkout@v6
uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup Go - uses: actions/setup-go@v6
uses: actions/setup-go@v5
with: with:
go-version-file: go.mod go-version-file: "go.mod"
cache: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v7
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser - name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6 uses: goreleaser/goreleaser-action@v7
with: with:
distribution: goreleaser
version: '~> v2'
args: release --clean args: release --clean
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
+42 -12
View File
@@ -8,28 +8,58 @@ before:
builds: builds:
- id: terraform-provider-dynu - id: terraform-provider-dynu
binary: terraform-provider-dynu
main: ./main.go main: ./main.go
binary: "{{ .ProjectName }}_v{{ .Version }}"
env: env:
- CGO_ENABLED=0 - CGO_ENABLED=0
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags: ldflags:
- -s -w -X main.version={{ .Version }} -X main.commit={{ .ShortCommit }} -X main.date={{ .Date }} - "-s -w -X main.version={{ .Version }} -X main.commit={{ .Commit }} -X main.date={{ .Date }}"
goos: [linux, darwin, windows] goos:
goarch: [amd64, arm64] - darwin
- linux
- windows
- freebsd
goarch:
- amd64
- arm64
- arm
- "386"
ignore: ignore:
- goos: darwin
goarch: "386"
- goos: windows - goos: windows
goarch: arm64 goarch: arm
archives: archives:
- id: provider-archives - formats:
ids:
- terraform-provider-dynu
formats:
- zip - zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
checksum: checksum:
name_template: 'terraform-provider-dynu_{{ .Version }}_SHA256SUMS' extra_files:
- glob: "terraform-registry-manifest.json"
name_template: "{{ .ProjectName }}_{{ .Version }}_manifest.json"
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
algorithm: sha256
signs:
- artifacts: checksum
args:
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}"
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
release:
extra_files:
- glob: "terraform-registry-manifest.json"
name_template: "{{ .ProjectName }}_{{ .Version }}_manifest.json"
changelog: changelog:
use: git disable: true
+5
View File
@@ -0,0 +1,5 @@
# Changelog
## 0.1.0
Initial public Terraform Registry release for `beatz174-bit/dynu`.
+17 -5
View File
@@ -22,7 +22,8 @@ Deleting `dynu_domain` deletes the full Dynu DNS zone for that domain. Treat des
terraform { terraform {
required_providers { required_providers {
dynu = { dynu = {
source = "dynu/dynu" source = "beatz174-bit/dynu"
version = "~> 0.1.0"
} }
} }
} }
@@ -50,7 +51,7 @@ variable "dynu_api_key" {
## Local development and dev overrides ## Local development and dev overrides
This provider is not yet published to the Terraform Registry. Use `dev_overrides` with a local build. For local development, use `dev_overrides` with a local build of this provider binary.
```bash ```bash
go build -o terraform-provider-dynu go build -o terraform-provider-dynu
@@ -61,7 +62,7 @@ go build -o terraform-provider-dynu
```hcl ```hcl
provider_installation { provider_installation {
dev_overrides { dev_overrides {
"dynu/dynu" = "/path/to/terraform-dynu-provider" "beatz174-bit/dynu" = "/path/to/terraform-dynu-provider"
} }
direct {} direct {}
@@ -104,12 +105,23 @@ Use a disposable domain/subdomain only.
## Release ## Release
- Terraform provider source address: `beatz174-bit/dynu`.
- Repository name must remain `terraform-provider-dynu`.
- Releases are triggered by pushing a semantic version tag such as `v0.1.0`.
- Required GitHub Actions secrets:
- `GPG_PRIVATE_KEY`
- `PASSPHRASE`
- Add the matching public GPG key to Terraform Registry before publishing, so signature verification succeeds.
Build a local stamped binary: Build a local stamped binary:
```bash ```bash
./build.sh v0.1.0 ./build.sh v0.1.0
``` ```
Tagged releases (`v*`) run `.github/workflows/release.yml` with GoReleaser to produce multi-platform archives and checksums. Create and push a release tag:
Terraform Registry signing is not configured in this repository yet. ```bash
git tag v0.1.0
git push origin v0.1.0
```
+2 -1
View File
@@ -15,7 +15,8 @@ This provider repository is standalone and does not require any external compani
terraform { terraform {
required_providers { required_providers {
dynu = { dynu = {
source = "dynu/dynu" source = "beatz174-bit/dynu"
version = "~> 0.1.0"
} }
} }
} }
@@ -1,7 +1,8 @@
terraform { terraform {
required_providers { required_providers {
dynu = { dynu = {
source = "dynu/dynu" source = "beatz174-bit/dynu"
version = "~> 0.1.0"
} }
} }
} }
@@ -1,7 +1,8 @@
terraform { terraform {
required_providers { required_providers {
dynu = { dynu = {
source = "dynu/dynu" source = "beatz174-bit/dynu"
version = "~> 0.1.0"
} }
} }
} }
@@ -1,7 +1,8 @@
terraform { terraform {
required_providers { required_providers {
dynu = { dynu = {
source = "dynu/dynu" source = "beatz174-bit/dynu"
version = "~> 0.1.0"
} }
} }
} }
+1 -1
View File
@@ -19,7 +19,7 @@ This example performs full live validation of the Dynu provider lifecycle by cre
## Prerequisites ## Prerequisites
- A local build of this provider with Terraform `dev_overrides` for `dynu/dynu`. - A local build of this provider with Terraform `dev_overrides` for `beatz174-bit/dynu`.
- Dynu API key provided as Terraform variable `dynu_api_key` (for example via `terraform.tfvars`). - Dynu API key provided as Terraform variable `dynu_api_key` (for example via `terraform.tfvars`).
- A disposable domain value for `test_domain`. - A disposable domain value for `test_domain`.
+2 -1
View File
@@ -1,7 +1,8 @@
terraform { terraform {
required_providers { required_providers {
dynu = { dynu = {
source = "dynu/dynu" source = "beatz174-bit/dynu"
version = "~> 0.1.0"
} }
} }
} }
+1 -1
View File
@@ -17,7 +17,7 @@ Using a single suffix (`test_suffix`), this example creates five DNS record scen
## Prerequisites ## Prerequisites
- Local provider binary + Terraform `dev_overrides` for `dynu/dynu` - Local provider binary + Terraform `dev_overrides` for `beatz174-bit/dynu`
- `dynu_api_key` set in `terraform.tfvars` - `dynu_api_key` set in `terraform.tfvars`
- A Dynu-managed root domain you control - A Dynu-managed root domain you control
+1 -1
View File
@@ -1,5 +1,5 @@
# Local development note: # Local development note:
# Keep source as "dynu/dynu" and use ~/.terraformrc dev_overrides to point to # Keep source as "beatz174-bit/dynu" and use ~/.terraformrc dev_overrides to point to
# your local terraform-provider-dynu binary during provider development. # your local terraform-provider-dynu binary during provider development.
provider "dynu" { provider "dynu" {
api_key = var.dynu_api_key api_key = var.dynu_api_key
+2 -1
View File
@@ -3,7 +3,8 @@ terraform {
required_providers { required_providers {
dynu = { dynu = {
source = "dynu/dynu" source = "beatz174-bit/dynu"
version = "~> 0.1.0"
} }
} }
} }
+2 -1
View File
@@ -1,7 +1,8 @@
terraform { terraform {
required_providers { required_providers {
dynu = { dynu = {
source = "dynu/dynu" source = "beatz174-bit/dynu"
version = "~> 0.1.0"
} }
} }
} }
+3 -2
View File
@@ -3,13 +3,14 @@ terraform {
required_providers { required_providers {
dynu = { dynu = {
source = "dynu/dynu" source = "beatz174-bit/dynu"
version = "~> 0.1.0"
} }
} }
} }
# Local development note: # Local development note:
# This source address stays "dynu/dynu" while using ~/.terraformrc dev_overrides. # This source address stays "beatz174-bit/dynu" while using ~/.terraformrc dev_overrides.
# Terraform will load your local terraform-provider-dynu binary instead of the public registry. # Terraform will load your local terraform-provider-dynu binary instead of the public registry.
provider "dynu" { provider "dynu" {
# Set var.dynu_api_key in terraform.tfvars. # Set var.dynu_api_key in terraform.tfvars.
+1 -1
View File
@@ -1,4 +1,4 @@
module github.com/dynu/terraform-provider-dynu module github.com/beatz174-bit/terraform-provider-dynu
go 1.24.0 go 1.24.0
+2 -2
View File
@@ -8,8 +8,8 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/dynu/terraform-provider-dynu/internal/dynuclient" "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient"
"github.com/dynu/terraform-provider-dynu/internal/testutil/fakedynu" "github.com/beatz174-bit/terraform-provider-dynu/internal/testutil/fakedynu"
) )
func TestClientListDomainsSuccess(t *testing.T) { func TestClientListDomainsSuccess(t *testing.T) {
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"errors" "errors"
"strings" "strings"
"github.com/dynu/terraform-provider-dynu/internal/dynuclient" "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient"
) )
func diagnosticSummary(defaultSummary string, err error) string { func diagnosticSummary(defaultSummary string, err error) string {
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types"
"github.com/dynu/terraform-provider-dynu/internal/dynuclient" "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient"
) )
var domainObjectTypes = map[string]attr.Type{ var domainObjectTypes = map[string]attr.Type{
+1 -1
View File
@@ -3,7 +3,7 @@ package provider
import ( import (
"testing" "testing"
"github.com/dynu/terraform-provider-dynu/internal/dynuclient" "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient"
) )
func TestSortDomains(t *testing.T) { func TestSortDomains(t *testing.T) {
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types"
"github.com/dynu/terraform-provider-dynu/internal/dynuclient" "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient"
) )
var _ provider.Provider = &dynuProvider{} var _ provider.Provider = &dynuProvider{}
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/dynu/terraform-provider-dynu/internal/dynuclient" "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient"
) )
func stringPtr(s string) *string { func stringPtr(s string) *string {
@@ -5,7 +5,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/dynu/terraform-provider-dynu/internal/testutil/fakedynu" "github.com/beatz174-bit/terraform-provider-dynu/internal/testutil/fakedynu"
"github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/tfsdk"
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/dynu/terraform-provider-dynu/internal/dynuclient" "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient"
"github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/provider"
"github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types"
) )
+1 -1
View File
@@ -19,7 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types"
"github.com/dynu/terraform-provider-dynu/internal/dynuclient" "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient"
) )
var ( var (
@@ -5,7 +5,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/dynu/terraform-provider-dynu/internal/testutil/fakedynu" "github.com/beatz174-bit/terraform-provider-dynu/internal/testutil/fakedynu"
"github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/tfsdk"
@@ -5,7 +5,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/dynu/terraform-provider-dynu/internal/dynuclient" "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient"
"github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types"
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types"
"github.com/dynu/terraform-provider-dynu/internal/dynuclient" "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient"
) )
var ( var (
@@ -4,7 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/dynu/terraform-provider-dynu/internal/testutil/fakedynu" "github.com/beatz174-bit/terraform-provider-dynu/internal/testutil/fakedynu"
"github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/tfsdk"
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/dynu/terraform-provider-dynu/internal/dynuclient" "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient"
) )
type RootDomain struct { type RootDomain struct {
+2 -2
View File
@@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/providerserver" "github.com/hashicorp/terraform-plugin-framework/providerserver"
"github.com/dynu/terraform-provider-dynu/internal/provider" "github.com/beatz174-bit/terraform-provider-dynu/internal/provider"
) )
var ( var (
@@ -26,7 +26,7 @@ func main() {
log.Printf("starting terraform-provider-dynu version=%s commit=%s built=%s", version, commit, date) log.Printf("starting terraform-provider-dynu version=%s commit=%s built=%s", version, commit, date)
err := providerserver.Serve(context.Background(), provider.New(version), providerserver.ServeOpts{ err := providerserver.Serve(context.Background(), provider.New(version), providerserver.ServeOpts{
Address: "registry.terraform.io/dynu/dynu", Address: "registry.terraform.io/beatz174-bit/dynu",
}) })
if err != nil { if err != nil {
log.Fatal(err.Error()) log.Fatal(err.Error())
+6
View File
@@ -0,0 +1,6 @@
{
"version": 1,
"metadata": {
"protocol_versions": ["6.0"]
}
}