This repository publishes a Terraform provider network mirror for terraform-provider-postgresql on GitHub Pages.
A Terraform network mirror is a static HTTP server that hosts Terraform provider packages. This allows organizations to:
- Control provider distribution: Host providers internally
- Improve reliability: Reduce dependency on external registries
- Increase performance: Faster downloads from a local/regional mirror
- Support air-gapped environments: Use Terraform without internet access
Add the following to your Terraform CLI configuration file:
Linux/macOS: ~/.terraformrc
Windows: %APPDATA%\terraform.rc
provider_installation {
network_mirror {
url = "https://swile.github.io/terraform-provider-postgresql/"
include = ["registry.terraform.io/cyrilgdn/postgresql"]
}
}In your Terraform configuration:
terraform {
required_providers {
postgresql = {
source = "cyrilgdn/postgresql"
version = "~> 1.0"
}
}
}
provider "postgresql" {
}Run terraform init to verify that Terraform is using the network mirror:
terraform initYou should see output indicating the provider is being downloaded from the mirror URL.
- Release Creation: When a new release is created (via the
releaseworkflow), GoReleaser builds provider binaries for multiple platforms - Mirror Publication: The
publish-mirrorjob downloads release artifacts and generates the required metadata structure - GitHub Pages Deployment: Files are deployed to the
gh-pagesbranch and served via GitHub Pages
The network mirror follows the Terraform provider network mirror protocol:
registry.terraform.io/
└── cyrilgdn/
└── postgresql/
├── index.json # Available versions
└── {VERSION}.json # Platform-specific downloads
└── {VERSION}/
├── terraform-provider-postgresql_{VERSION}_{OS}_{ARCH}.zip
└── terraform-provider-postgresql_{VERSION}_SHA256SUMS
The following platforms are built and published:
darwin_amd64(macOS Intel)darwin_arm64(macOS Apple Silicon)linux_amd64(Linux 64-bit)linux_386(Linux 32-bit)linux_arm64(Linux ARM 64-bit)linux_arm(Linux ARM)
-
Build the provider:
go build -o terraform-provider-postgresql
-
Generate mirror metadata:
./scripts/generate-mirror-metadata.sh <version> cyrilgdn postgresql ./mirror/registry.terraform.io
-
Serve the mirror locally:
cd mirror python3 -m http.server 8080 -
Configure Terraform to use the local mirror:
provider_installation { network_mirror { url = "http://localhost:8080/registry.terraform.io/" } }
If Terraform cannot find the provider:
- Verify the mirror URL is correct in your
~/.terraformrc - Check that the version exists in the versions metadata
- Ensure your platform is supported
If checksums don't match:
- Re-download the provider by removing the Terraform cache:
rm -rf ~/.terraform.d/plugins - Run
terraform initagain - If the issue persists, check the release artifacts on GitHub