generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "porkbun_domain Resource - terraform-provider-porkbun" subcategory: "" description: |- Registers a domain and holds it in state. The price is not written in the configuration. On create the provider quotes the domain through /domain/checkDomain, converts the quote to the US cents the API demands, and sends that as cost. Set max_cost to put a ceiling on what an unattended apply may spend: a first-year promotional price that lapses would otherwise be paid silently at the standard rate. Porkbun exposes no endpoint that deletes a registration, so terraform destroy only drops the resource from state. The registration itself stands until it expires. Guard the resource with prevent_destroy if an accidental removal from state would be costly to reconcile.
porkbun_domain (Resource)
Registers a domain and holds it in state.
The price is not written in the configuration. On create the provider quotes the domain through /domain/checkDomain, converts the quote to the US cents the API demands, and sends that as cost. Set max_cost to put a ceiling on what an unattended apply may spend: a first-year promotional price that lapses would otherwise be paid silently at the standard rate.
Porkbun exposes no endpoint that deletes a registration, so terraform destroy only drops the resource from state. The registration itself stands until it expires. Guard the resource with prevent_destroy if an accidental removal from state would be costly to reconcile.
Example Usage
resource "porkbun_domain" "example" {
domain = "jiancodes.com"
# Refuse the registration if it is quoted above this, in US cents.
max_cost = 1200
}
Schema
Required
domain(String) (Force new) The fully qualified domain name to register.
Optional
max_cost(Number) The most, in US cents, that this registration may cost. The apply fails before anything is charged if the live quote is higher. Omit to accept any price.whois_privacy(Boolean) (Force new) Whether to register with WHOIS privacy protection, which hides personal registrant details from the public WHOIS database. Defaults to the account-level setting. A TLD that does not offer privacy ignores this.
Read-Only
api_access(Boolean) Indicates whether API access is enabled for the domain.auto_renew(Boolean) Indicates whether the domain will automatically renew before its expiration date.cost(Number) What the registration actually cost, in US cents.create_date(String) The creation date of the domain.expire_date(String) The expiration date of the domain.not_local(Boolean) Indicates if the domain is registered with an external, third-party registrar.order_id(Number) Porkbun's internal order id for the registration.security_lock(Boolean) Indicates if the Registrar Lock/Transfer Lock is enabled to prevent unauthorized domain transfers.status(String) The status of the domain.tld(String) The TLD of the domain.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
terraform import porkbun_domain.example <domain>
terraform import porkbun_domain.example jiancodes.com