Archived
Live Safe DNS Record Example
This example is an opt-in live test for writable Dynu provider functionality. It creates real Dynu DNS records and is designed for disposable, test-owned hostnames only.
What this creates
Using a single suffix (test_suffix), this example creates five DNS record scenarios under dynu_root_domain:
Arecord with IPv4 content,location, and minimum TTL=90 (codex-a-<suffix>.<root_domain>)AAAArecord with IPv6 content andlocation(codex-aaaa-<suffix>.<root_domain>)CNAMErecord created disabled (enabled = false) (codex-cname-<suffix>.<root_domain>)- Dynamic
Arecord with omitted content (codex-dynamic-a-<suffix>.<root_domain>) - Dynamic
AAAArecord with omitted content (codex-dynamic-aaaa-<suffix>.<root_domain>)
Warning
Do not use a suffix that overlaps important existing hostnames. This example is intended only for disposable test records that you can safely destroy.
Prerequisites
- Local provider binary + Terraform
dev_overridesfordynu/dynu DYNU_API_KEYexported, ordynu_api_keyset interraform.tfvars- A Dynu-managed root domain you control
Configure
cp terraform.tfvars.example terraform.tfvars
Edit terraform.tfvars and set at least:
dynu_root_domaintest_suffix(use a unique value per run)
Optional overrides include test_ipv4, test_ipv6, test_cname_target, test_ttl, and test_location.
test_ttlmust be0(provider/API default) or>= 90.test_locationapplies only to A/AAAA records.
Run
terraform init
terraform validate
terraform plan
terraform apply
terraform destroy
Notes
terraform applyshould create all five record scenarios (including a disabled CNAME example).terraform destroyshould remove all five records created by this state.- If you need to target a single scenario, resources are explicitly named:
dynu_dns_record.a_ipv4dynu_dns_record.aaaa_ipv6dynu_dns_record.cnamedynu_dns_record.dynamic_adynu_dns_record.dynamic_aaaa
Verification commands:
dig A codex-dynamic-a-<suffix>.<root_domain>
dig AAAA codex-dynamic-aaaa-<suffix>.<root_domain>
dig CNAME codex-cname-<suffix>.<root_domain>
dig <hostname> defaults to an A lookup, which can be misleading for AAAA-only checks.