From 16652ee1f27e9075a9b245b3b8bac3fb90911795 Mon Sep 17 00:00:00 2001 From: beatz174-bit Date: Tue, 12 May 2026 18:43:27 +1000 Subject: [PATCH] Prepare provider for public Terraform Registry publishing --- .github/workflows/release.yml | 25 +++++---- .goreleaser.yml | 54 ++++++++++++++----- CHANGELOG.md | 5 ++ README.md | 22 ++++++-- docs/index.md | 3 +- .../dynu_dns_records/data-source.tf | 3 +- .../data-sources/dynu_domain/data-source.tf | 3 +- .../data-sources/dynu_domains/data-source.tf | 3 +- examples/live_end_to_end_dns_zone/README.md | 2 +- examples/live_end_to_end_dns_zone/main.tf | 3 +- examples/live_safe_dns_record/README.md | 2 +- examples/live_safe_dns_record/main.tf | 2 +- examples/live_safe_dns_record/versions.tf | 3 +- examples/provider/provider.tf | 3 +- examples/read_only/providers.tf | 5 +- go.mod | 2 +- internal/dynuclient/client_test.go | 4 +- internal/provider/diagnostics.go | 2 +- internal/provider/mappers.go | 2 +- internal/provider/mappers_test.go | 2 +- internal/provider/provider.go | 2 +- internal/provider/provider_acc_test.go | 2 +- .../provider/provider_integration_test.go | 2 +- internal/provider/provider_test.go | 2 +- internal/provider/resource_dns_record.go | 2 +- .../resource_dns_record_integration_test.go | 2 +- internal/provider/resource_dns_record_test.go | 2 +- internal/provider/resource_domain.go | 2 +- .../resource_domain_integration_test.go | 2 +- internal/testutil/fakedynu/server.go | 2 +- main.go | 4 +- terraform-registry-manifest.json | 6 +++ 32 files changed, 123 insertions(+), 57 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 terraform-registry-manifest.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bf8b2d5..192241b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,9 @@ -name: release +name: Release on: push: tags: - - 'v*' + - "v*" permissions: contents: write @@ -12,21 +12,26 @@ jobs: goreleaser: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 - - name: Setup Go - uses: actions/setup-go@v5 + - uses: actions/setup-go@v6 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 - uses: goreleaser/goreleaser-action@v6 + uses: goreleaser/goreleaser-action@v7 with: - distribution: goreleaser - version: '~> v2' args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 362d30c..5609cf2 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -8,28 +8,58 @@ before: builds: - id: terraform-provider-dynu - binary: terraform-provider-dynu main: ./main.go + binary: "{{ .ProjectName }}_v{{ .Version }}" env: - CGO_ENABLED=0 + mod_timestamp: "{{ .CommitTimestamp }}" + flags: + - -trimpath ldflags: - - -s -w -X main.version={{ .Version }} -X main.commit={{ .ShortCommit }} -X main.date={{ .Date }} - goos: [linux, darwin, windows] - goarch: [amd64, arm64] + - "-s -w -X main.version={{ .Version }} -X main.commit={{ .Commit }} -X main.date={{ .Date }}" + goos: + - darwin + - linux + - windows + - freebsd + goarch: + - amd64 + - arm64 + - arm + - "386" ignore: + - goos: darwin + goarch: "386" - goos: windows - goarch: arm64 + goarch: arm archives: - - id: provider-archives - ids: - - terraform-provider-dynu - formats: + - formats: - zip - name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" 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: - use: git + disable: true diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..777545e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 0.1.0 + +Initial public Terraform Registry release for `beatz174-bit/dynu`. diff --git a/README.md b/README.md index 7afe33e..f27a1aa 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,8 @@ Deleting `dynu_domain` deletes the full Dynu DNS zone for that domain. Treat des terraform { required_providers { 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 -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 go build -o terraform-provider-dynu @@ -61,7 +62,7 @@ go build -o terraform-provider-dynu ```hcl provider_installation { dev_overrides { - "dynu/dynu" = "/path/to/terraform-dynu-provider" + "beatz174-bit/dynu" = "/path/to/terraform-dynu-provider" } direct {} @@ -104,12 +105,23 @@ Use a disposable domain/subdomain only. ## 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: ```bash ./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 +``` diff --git a/docs/index.md b/docs/index.md index 6ea04f7..c83addf 100644 --- a/docs/index.md +++ b/docs/index.md @@ -15,7 +15,8 @@ This provider repository is standalone and does not require any external compani terraform { required_providers { dynu = { - source = "dynu/dynu" + source = "beatz174-bit/dynu" + version = "~> 0.1.0" } } } diff --git a/examples/data-sources/dynu_dns_records/data-source.tf b/examples/data-sources/dynu_dns_records/data-source.tf index 7c06b29..90e891b 100644 --- a/examples/data-sources/dynu_dns_records/data-source.tf +++ b/examples/data-sources/dynu_dns_records/data-source.tf @@ -1,7 +1,8 @@ terraform { required_providers { dynu = { - source = "dynu/dynu" + source = "beatz174-bit/dynu" + version = "~> 0.1.0" } } } diff --git a/examples/data-sources/dynu_domain/data-source.tf b/examples/data-sources/dynu_domain/data-source.tf index 6e1d468..17b441e 100644 --- a/examples/data-sources/dynu_domain/data-source.tf +++ b/examples/data-sources/dynu_domain/data-source.tf @@ -1,7 +1,8 @@ terraform { required_providers { dynu = { - source = "dynu/dynu" + source = "beatz174-bit/dynu" + version = "~> 0.1.0" } } } diff --git a/examples/data-sources/dynu_domains/data-source.tf b/examples/data-sources/dynu_domains/data-source.tf index 97d4811..892bc07 100644 --- a/examples/data-sources/dynu_domains/data-source.tf +++ b/examples/data-sources/dynu_domains/data-source.tf @@ -1,7 +1,8 @@ terraform { required_providers { dynu = { - source = "dynu/dynu" + source = "beatz174-bit/dynu" + version = "~> 0.1.0" } } } diff --git a/examples/live_end_to_end_dns_zone/README.md b/examples/live_end_to_end_dns_zone/README.md index 86d489e..7186cbd 100644 --- a/examples/live_end_to_end_dns_zone/README.md +++ b/examples/live_end_to_end_dns_zone/README.md @@ -19,7 +19,7 @@ This example performs full live validation of the Dynu provider lifecycle by cre ## 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`). - A disposable domain value for `test_domain`. diff --git a/examples/live_end_to_end_dns_zone/main.tf b/examples/live_end_to_end_dns_zone/main.tf index 0fee929..eba2a4b 100644 --- a/examples/live_end_to_end_dns_zone/main.tf +++ b/examples/live_end_to_end_dns_zone/main.tf @@ -1,7 +1,8 @@ terraform { required_providers { dynu = { - source = "dynu/dynu" + source = "beatz174-bit/dynu" + version = "~> 0.1.0" } } } diff --git a/examples/live_safe_dns_record/README.md b/examples/live_safe_dns_record/README.md index 76b6123..ff93d97 100644 --- a/examples/live_safe_dns_record/README.md +++ b/examples/live_safe_dns_record/README.md @@ -17,7 +17,7 @@ Using a single suffix (`test_suffix`), this example creates five DNS record scen ## 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` - A Dynu-managed root domain you control diff --git a/examples/live_safe_dns_record/main.tf b/examples/live_safe_dns_record/main.tf index aa61ffa..7bb58a9 100644 --- a/examples/live_safe_dns_record/main.tf +++ b/examples/live_safe_dns_record/main.tf @@ -1,5 +1,5 @@ # 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. provider "dynu" { api_key = var.dynu_api_key diff --git a/examples/live_safe_dns_record/versions.tf b/examples/live_safe_dns_record/versions.tf index 572584b..c152b0c 100644 --- a/examples/live_safe_dns_record/versions.tf +++ b/examples/live_safe_dns_record/versions.tf @@ -3,7 +3,8 @@ terraform { required_providers { dynu = { - source = "dynu/dynu" + source = "beatz174-bit/dynu" + version = "~> 0.1.0" } } } diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 6e873a3..8cd808b 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -1,7 +1,8 @@ terraform { required_providers { dynu = { - source = "dynu/dynu" + source = "beatz174-bit/dynu" + version = "~> 0.1.0" } } } diff --git a/examples/read_only/providers.tf b/examples/read_only/providers.tf index 128654c..8cfebd7 100644 --- a/examples/read_only/providers.tf +++ b/examples/read_only/providers.tf @@ -3,13 +3,14 @@ terraform { required_providers { dynu = { - source = "dynu/dynu" + source = "beatz174-bit/dynu" + version = "~> 0.1.0" } } } # 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. provider "dynu" { # Set var.dynu_api_key in terraform.tfvars. diff --git a/go.mod b/go.mod index 2cfe612..5fe8954 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/dynu/terraform-provider-dynu +module github.com/beatz174-bit/terraform-provider-dynu go 1.24.0 diff --git a/internal/dynuclient/client_test.go b/internal/dynuclient/client_test.go index b623f1c..3854a79 100644 --- a/internal/dynuclient/client_test.go +++ b/internal/dynuclient/client_test.go @@ -8,8 +8,8 @@ import ( "strings" "testing" - "github.com/dynu/terraform-provider-dynu/internal/dynuclient" - "github.com/dynu/terraform-provider-dynu/internal/testutil/fakedynu" + "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient" + "github.com/beatz174-bit/terraform-provider-dynu/internal/testutil/fakedynu" ) func TestClientListDomainsSuccess(t *testing.T) { diff --git a/internal/provider/diagnostics.go b/internal/provider/diagnostics.go index 2948770..621b990 100644 --- a/internal/provider/diagnostics.go +++ b/internal/provider/diagnostics.go @@ -4,7 +4,7 @@ import ( "errors" "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 { diff --git a/internal/provider/mappers.go b/internal/provider/mappers.go index 8dc39ca..1dc2e39 100644 --- a/internal/provider/mappers.go +++ b/internal/provider/mappers.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/diag" "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{ diff --git a/internal/provider/mappers_test.go b/internal/provider/mappers_test.go index c37af5e..0e5b7f6 100644 --- a/internal/provider/mappers_test.go +++ b/internal/provider/mappers_test.go @@ -3,7 +3,7 @@ package provider import ( "testing" - "github.com/dynu/terraform-provider-dynu/internal/dynuclient" + "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient" ) func TestSortDomains(t *testing.T) { diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 160bd43..bd6c17e 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "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{} diff --git a/internal/provider/provider_acc_test.go b/internal/provider/provider_acc_test.go index 1f009af..8955457 100644 --- a/internal/provider/provider_acc_test.go +++ b/internal/provider/provider_acc_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/dynu/terraform-provider-dynu/internal/dynuclient" + "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient" ) func stringPtr(s string) *string { diff --git a/internal/provider/provider_integration_test.go b/internal/provider/provider_integration_test.go index c0acf26..c6f31d0 100644 --- a/internal/provider/provider_integration_test.go +++ b/internal/provider/provider_integration_test.go @@ -5,7 +5,7 @@ import ( "strings" "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/path" "github.com/hashicorp/terraform-plugin-framework/tfsdk" diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index 0ccb11a..12a44f7 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -7,7 +7,7 @@ import ( "strings" "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/types" ) diff --git a/internal/provider/resource_dns_record.go b/internal/provider/resource_dns_record.go index 4402359..c1bb070 100644 --- a/internal/provider/resource_dns_record.go +++ b/internal/provider/resource_dns_record.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/schema/validator" "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 ( diff --git a/internal/provider/resource_dns_record_integration_test.go b/internal/provider/resource_dns_record_integration_test.go index ab7e149..a49bf7c 100644 --- a/internal/provider/resource_dns_record_integration_test.go +++ b/internal/provider/resource_dns_record_integration_test.go @@ -5,7 +5,7 @@ import ( "strings" "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/resource" "github.com/hashicorp/terraform-plugin-framework/tfsdk" diff --git a/internal/provider/resource_dns_record_test.go b/internal/provider/resource_dns_record_test.go index ad05cb3..aa53523 100644 --- a/internal/provider/resource_dns_record_test.go +++ b/internal/provider/resource_dns_record_test.go @@ -5,7 +5,7 @@ import ( "strings" "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/resource" "github.com/hashicorp/terraform-plugin-framework/types" diff --git a/internal/provider/resource_domain.go b/internal/provider/resource_domain.go index f95f3cb..509b59c 100644 --- a/internal/provider/resource_domain.go +++ b/internal/provider/resource_domain.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "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 ( diff --git a/internal/provider/resource_domain_integration_test.go b/internal/provider/resource_domain_integration_test.go index 1a85ed6..0c1fdb1 100644 --- a/internal/provider/resource_domain_integration_test.go +++ b/internal/provider/resource_domain_integration_test.go @@ -4,7 +4,7 @@ import ( "context" "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/resource" "github.com/hashicorp/terraform-plugin-framework/tfsdk" diff --git a/internal/testutil/fakedynu/server.go b/internal/testutil/fakedynu/server.go index 43e4ce3..52c415f 100644 --- a/internal/testutil/fakedynu/server.go +++ b/internal/testutil/fakedynu/server.go @@ -11,7 +11,7 @@ import ( "sync" "time" - "github.com/dynu/terraform-provider-dynu/internal/dynuclient" + "github.com/beatz174-bit/terraform-provider-dynu/internal/dynuclient" ) type RootDomain struct { diff --git a/main.go b/main.go index b4b4302..e95fe85 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( "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 ( @@ -26,7 +26,7 @@ func main() { 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{ - Address: "registry.terraform.io/dynu/dynu", + Address: "registry.terraform.io/beatz174-bit/dynu", }) if err != nil { log.Fatal(err.Error()) diff --git a/terraform-registry-manifest.json b/terraform-registry-manifest.json new file mode 100644 index 0000000..295001a --- /dev/null +++ b/terraform-registry-manifest.json @@ -0,0 +1,6 @@ +{ + "version": 1, + "metadata": { + "protocol_versions": ["6.0"] + } +}