Porkbun Resource Provider
A Pulumi provider for Porkbun: manage DNS records and the nameservers your domains are delegated to, in TypeScript, Python, Go, C# or YAML.
It is a native provider built on the Porkbun API v3 with pulumi-go-provider. It is not affiliated with Porkbun.
What it manages
porkbun.DnsRecord |
One DNS record: A, AAAA, CNAME, ALIAS, MX, TXT, NS, SRV, TLSA, CAA, HTTPS, SVCB |
porkbun.DomainNameservers |
The nameservers a domain is delegated to, e.g. to move its DNS to Cloudflare while Porkbun stays the registrar |
porkbun.getDnsRecords |
Every record on a domain, with the IDs you need to import them |
porkbun.getNameservers |
A domain's current nameservers |
Existing records and nameservers can be imported without changing them.
Installing
The provider plugin downloads automatically the first time a program uses it. Install the SDK for your language:
Node.js (TypeScript or JavaScript)
npm install @rainnworks/porkbun
Python
pip install rainnworks-porkbun
Go
go get github.com/RainnWorks/pulumi-porkbun/sdk/go/porkbun
.NET
dotnet add package RainnWorks.Porkbun
YAML: nothing to install. Refer to the resources as porkbun:DnsRecord and
porkbun:DomainNameservers, and add the plugin to Pulumi.yaml:
plugins:
providers:
- name: porkbun
version: 0.1.0
or install it by hand with
pulumi plugin install resource porkbun --server github://api.github.com/RainnWorks/pulumi-porkbun.
Configuring
You need an API key pair from porkbun.com/account/api, and API access turned on for each domain you manage (Domain Management → the domain → Details → API Access). Without that, every call for the domain fails.
Set the keys as stack configuration, as secrets:
pulumi config set porkbun:apiKey pk1_... --secret
pulumi config set porkbun:secretApiKey sk1_... --secret
or in the environment, which keeps them out of the stack entirely. When both are set, stack configuration wins.
export PORKBUN_API_KEY=pk1_...
export PORKBUN_SECRET_API_KEY=sk1_...
| Option | Environment variable | |
|---|---|---|
porkbun:apiKey |
PORKBUN_API_KEY |
Required. Secret |
porkbun:secretApiKey |
PORKBUN_SECRET_API_KEY |
Required. Secret |
porkbun:baseUrl |
PORKBUN_BASE_URL |
Optional. Only for testing against another endpoint |
Example
import * as porkbun from "@rainnworks/porkbun";
const domain = "example.com";
new porkbun.DnsRecord("apex", { domain, type: "A", content: "203.0.113.10" });
new porkbun.DnsRecord("www", { domain, name: "www", type: "CNAME", content: domain });
new porkbun.DnsRecord("mx", { domain, type: "MX", content: "mail.example.com", prio: 10 });
new porkbun.DnsRecord("spf", { domain, type: "TXT", content: "v=spf1 mx ~all" });
The same program in every language is in examples/.
Moving a domain's DNS to Cloudflare
Keep Porkbun as the registrar and hand DNS to Cloudflare: create the zone, then point the domain at the nameservers Cloudflare assigned.
import * as cloudflare from "@pulumi/cloudflare";
import * as porkbun from "@rainnworks/porkbun";
const zone = new cloudflare.Zone("example", {
account: { id: accountId },
name: "example.com",
});
new porkbun.DomainNameservers("example", {
domain: "example.com",
nameservers: zone.nameServers,
});
Copy every record into the new zone before the nameservers change, and check the copy, or the domain stops resolving for as long as the gap lasts.
Deleting a DomainNameservers resource does not change the domain's
nameservers. Reverting a delegation would take the domain offline, so removing
the resource only stops Pulumi managing it.
Importing what you already have
List a domain's records and their IDs:
const records = porkbun.getDnsRecordsOutput({ domain: "example.com" });
export const ids = records.records.apply(rs => rs.map(r => `${r.fqdn} ${r.type} ${r.recordId}`));
then import each one as <domain>/<recordId>, and the nameservers by domain:
pulumi import porkbun:index:DnsRecord www example.com/123456789
pulumi import porkbun:index:DomainNameservers example example.com
pulumi import prints the code for what it imported. A pulumi preview straight
after should show no changes.
How it behaves
- Names are subdomains.
name: "www"onexample.comiswww.example.com; leavenameout for the apex and use*for a wildcard. Thefqdnoutput has the full name. - TTL defaults to 600 seconds, Porkbun's minimum.
- Edits happen in place. Only changing
domainreplaces a record. - Removing an input clears it. Drop
notesorpriofrom a record and the next update clears it in Porkbun, rather than leaving the old value behind. - Refresh is quiet about cosmetic differences. Letter case, an empty note and a zero priority read back the way your program wrote them.
- Writes are safe to retry. Each write carries an
Idempotency-Key, so a retry after a dropped connection cannot create a second record. Rate-limited calls wait forRetry-Afterand try again. - Porkbun's warnings are passed on. For example, Porkbun accepts records for a domain delegated elsewhere, where they won't resolve, and says so.
Reference
Full documentation for every resource, function and property is on the
Pulumi Registry once
published, and in docs/.
Developing
See CONTRIBUTING.md. In short:
make provider # build bin/pulumi-resource-porkbun
make test # unit tests against an in-memory Porkbun
make codegen # regenerate the schema and the SDKs after changing the provider
License
Metadata
Release files for rainnworks-porkbun 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rainnworks_porkbun-0.1.2.tar.gz | 16.6 kB | With provenance | Details for rainnworks_porkbun-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rainnworks_porkbun-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for rainnworks_porkbun-0.1.2-py3-none-any.whl |
Total release size: 37.8 kB
Release files / rainnworks_porkbun-0.1.2.tar.gz
| Download URL | rainnworks_porkbun-0.1.2.tar.gz |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
097d187addf8962af1ce237735f24c9421c0428efc748242d713dbaffb21f42d
|
|
BLAKE2b-256 checksum How to use checksums |
6450c462a13657b6e5525735c1f280ab0eb50febfba10175b921e74fba902af8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logRelease files / rainnworks_porkbun-0.1.2-py3-none-any.whl
| Download URL | rainnworks_porkbun-0.1.2-py3-none-any.whl |
|---|---|
| Size | 21.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6245bca7f20480d0ceb4023ac3fb771f4c8e680936e8c5f2583f9ca828f8ac5c
|
|
BLAKE2b-256 checksum How to use checksums |
49fac2eb40e3e5d93bf8c6e92a1f2f18ed532b2e021901747af459958a4f6581
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logSecurity for rainnworks-porkbun 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for rainnworks_porkbun-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.