Archived
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:
@@ -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 }}
|
||||
|
||||
+42
-12
@@ -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
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## 0.1.0
|
||||
|
||||
Initial public Terraform Registry release for `beatz174-bit/dynu`.
|
||||
@@ -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
|
||||
```
|
||||
|
||||
+2
-1
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
dynu = {
|
||||
source = "dynu/dynu"
|
||||
source = "beatz174-bit/dynu"
|
||||
version = "~> 0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
dynu = {
|
||||
source = "dynu/dynu"
|
||||
source = "beatz174-bit/dynu"
|
||||
version = "~> 0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
dynu = {
|
||||
source = "dynu/dynu"
|
||||
source = "beatz174-bit/dynu"
|
||||
version = "~> 0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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`.
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
dynu = {
|
||||
source = "dynu/dynu"
|
||||
source = "beatz174-bit/dynu"
|
||||
version = "~> 0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -3,7 +3,8 @@ terraform {
|
||||
|
||||
required_providers {
|
||||
dynu = {
|
||||
source = "dynu/dynu"
|
||||
source = "beatz174-bit/dynu"
|
||||
version = "~> 0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
dynu = {
|
||||
source = "dynu/dynu"
|
||||
source = "beatz174-bit/dynu"
|
||||
version = "~> 0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module github.com/dynu/terraform-provider-dynu
|
||||
module github.com/beatz174-bit/terraform-provider-dynu
|
||||
|
||||
go 1.24.0
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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{}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 1,
|
||||
"metadata": {
|
||||
"protocol_versions": ["6.0"]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user