cullenmcdermott / terraform-provider-porkbun Goto Github PK
View Code? Open in Web Editor NEWLicense: Mozilla Public License 2.0
License: Mozilla Public License 2.0
after applying, TF tries to reapply something to do with the ID
I do an apply, then another apply without any changes....
# porkbun_dns_record.housecarl-cloud will be updated in-place
~ resource "porkbun_dns_record" "housecarl-cloud" {
id = "342798344"
# (5 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
╷
│ Warning: Redundant ignore_changes element
│
│ on main.tf line 52, in resource "porkbun_dns_record" "housecarl-cloud":
│ 52: resource porkbun_dns_record "housecarl-cloud" {
│
│ Adding an attribute name to ignore_changes tells Terraform to ignore future changes to the argument in configuration after the object has been created, retaining the
│ value originally configured.
│
│ The attribute id is decided by the provider alone and therefore there can be no configured value to compare with. Including this attribute in ignore_changes has no
│ effect. Remove the attribute from ignore_changes to quiet this warning.
╵
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
porkbun_dns_record.housecarl-cloud: Modifying... [id=342798344]
╷
│ Error: Error updating the record
│
│ with porkbun_dns_record.housecarl-cloud,
│ on main.tf line 52, in resource "porkbun_dns_record" "housecarl-cloud":
│ 52: resource porkbun_dns_record "housecarl-cloud" {
│
│ Error status: 400 message: {"status":"ERROR","message":"Edit error: We were unable to edit the DNS record."}
╵
relevant resource:
resource porkbun_dns_record "housecarl-cloud" {
domain = "housecarl.cloud"
type = "A"
ttl = "300"
content = module.housecarl-site.ip_address
lifecycle {
ignore_changes = [id]
}
}
If tfstate is out of sync and contains records that don't actually exist, and you run terraform destroy it runs forever because they don't exist. This also impacts create (terraform returns no changes). This would also probably break if you tried to update the record.
Hi,
First, thanks for share this project! EXTREMELY useful for PorkBun users! 👍🏽
I'm facing some issues trying to manage the DNS records when those records applies to the "root" domain (when the parameter "name" is empty). I think these issues could be related with the fact that looks like the PorkBun API gets the name of the records with the domain appended, but I'm not sure.
The steps to reproduce the issue in my case are:
Terraform will perform the following actions:
# porkbun_dns_record.records will be created
+ resource "porkbun_dns_record" "records" {
+ content = "test.com"
+ domain = "mydomain.com"
+ id = (known after apply)
+ ttl = "600"
+ type = "ALIAS"
}
Plan: 1 to add, 0 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: .terraform/terraform.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply ".terraform/terraform.tfplan"
Terraform plan built successfully!
Applying Terraform plan:
porkbun_dns_record.records: Creating...
porkbun_dns_record.records: Creation complete after 2s [id=281421583]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Creation was OK, and I can see the DNS record successfully in the PorkBun dashboard... but if I just re-execute the code again (with NO changes at all, just re-run the Terraform code again) it's not idempotent... the execution fails:
Terraform will perform the following actions:
# porkbun_dns_record.records will be updated in-place
~ resource "porkbun_dns_record" "records" {
~ id = "281421583" -> (known after apply)
- name = "mydomain.com" -> null
# (4 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: .terraform/terraform.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply ".terraform/terraform.tfplan"
Terraform plan built successfully!
Applying Terraform plan:
porkbun_dns_record.records: Modifying... [id=281421583]
╷
│ Error: Error updating the record
│
│ with porkbun_dns_record.records,
│ on domains.tf line 18, in resource "porkbun_dns_record" "records":
│ 18: resource "porkbun_dns_record" "records" {
│
│ Error 400: {"status":"ERROR","message":"Edit error: We were unable to edit
│ the DNS record."}
╵
Looks like the "name" parameter retrieved from the PorkBun API has the domain attached, and this new execution try to modify it because the configured "name" in my code is still empty... and it fails.
Thanks in advance,
Hi,
I think the Porkbun API has very low limits about the requests/time and paralell requests.
If you use this provider to manage just a few DNS records, everything looks good... but if you are trying to handle bigger configurations, there are a lot of random issues during the Terraform plan/apply.
I disabled the Terraform paralelism (with terraform plan -parallelism=1
) and certainly it was better... but after adding a few more domains (nothing huge, just 5 or 6 domains with 6 or 7 DNS records each) the plan/apply is not able to work again.
So I'm pretty sure that there are some very low limits in the Porkbun API about concurrent request and request/min, at least.
There is no documentation at all in Porkbun website. I wrote to their support asking about that, but I have no response yet.
I was checking some other providers, and lot of them implements retries mechanism to avoid these kind of errors, so looks like the best solution to avoid error...
I wish I could send a PR with that implementation, but I'm not familiar with Go at all...
Regards,
When running 0.2.4 I get the below errors. Has something broken with the last release?
I'm not seeing any changes to the documentation indicating that the resource names have changed.
If I revert to 0.2.3 then the resources are updated from the API, but then I get "Invalid API key" errors then the plan is created.
│ Error: Resource Type Not Found
│
│ with porkbun_dns_record.wildcard,
│ on dns.tf line 1, in resource "porkbun_dns_record" "wildcard":
│ 1: resource "porkbun_dns_record" "wildcard" {
│
│ No resource type named "porkbun_dns_record" was found in the provider.
I'm configuring the provider like this:
provider "porkbun" {
api_key = data.vault_generic_secret.terraform.data["porkbun_api_key"]
secret_key = data.vault_generic_secret.terraform.data["porkbun_secret_key"]
}
terraform {
required_providers {
porkbun = {
source = "cullenmcdermott/porkbun"
version = "0.2.4"
}
}
}
Thanks for developing this provider plugin!
When I attempt to generate an NS record using the provider, it appears to perpetually hang (alt-tabbing to my terminal, the current attempt to create 4 records is up to Still creating... [8m50s elapsed]
I'm creating a hosted zone in AWS for a subdomain on an externally-hosted DNS provider, and then attempting to create NS records in Porkbun.
terraform {
required_providers {
porkbun = {
source = "cullenmcdermott/porkbun"
version = "0.2.0"
}
}
}
provider "porkbun" {
api_key = var.porkbun_api_key
secret_key = var.porkbun_secret_key
}
locals {
top_level_domain = "example.info" #Replaced with placeholder
subdomain = "testing" # Replaced with placeholder
domain_name = "testing.example.info"
}
resource "porkbun_dns_record" "ns_records" {
domain = local.top_level_domain
name = local.subdomain
type = "NS"
content = "ns-1566.awsdns-03.co.uk"
notes = "Test case!"
}
variable "porkbun_api_key" {
description = "The API key for your Porkbun account"
}
variable "porkbun_secret_key" {
description = "The SECRET key for your Porkbun account"
}
This results in the following plan:
Terraform will perform the following actions:
# porkbun_dns_record.ns_records will be created
+ resource "porkbun_dns_record" "ns_records" {
+ content = "ns-1566.awsdns-03.co.uk"
+ domain = "example.info"
+ id = (known after apply)
+ name = "testing"
+ notes = "Test case!"
+ type = "NS"
}
Plan: 1 to add, 0 to change, 0 to destroy.
The NS record is created in <30 seconds
When the plan is apply
ed, the logs are as follows:
porkbun_dns_record.ns_records: Creating...
porkbun_dns_record.ns_records: Still creating... [10s elapsed]
porkbun_dns_record.ns_records: Still creating... [20s elapsed]
porkbun_dns_record.ns_records: Still creating... [30s elapsed]
porkbun_dns_record.ns_records: Still creating... [40s elapsed]
porkbun_dns_record.ns_records: Still creating... [50s elapsed]
porkbun_dns_record.ns_records: Still creating... [1m0s elapsed]
[snip]
porkbun_dns_record.ns_records: Still creating... [4m30s elapsed]
porkbun_dns_record.ns_records: Still creating... [4m40s elapsed]
Interestingly, using the ctrl+c
interrupt at this point raises the message Please wait for Terraform to exit or data loss may occur. Gracefully shutting down..
but the Still creating...
logs continue to be printed.
I recently encountered a problem after updating from version 0.2.1 to 0.2.2 and 0.2.3. In these newer versions, I get an API auth error with the message Error: status: 400 message: {"status":"ERROR","message":"Invalid API key. (001)"}
, even though the access and secret key remain unchanged. Unfortunately, I haven't yet had time to delve into the exact code behind this issue. Am I missing something obvious?
Porkbun's API docs say that the minimum and default ttl for a record is 600. The provider should throw an error if someone tries to set less than that. https://porkbun.com/api/json/v3/documentation#DNS%20Create%20Record
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.