This repository has been archived on 2026-08-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
terraform-provider-dynu/examples/live_safe_dns_record

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:

  1. A record with IPv4 content (codex-a-<suffix>.<root_domain>)
  2. AAAA record with IPv6 content (codex-aaaa-<suffix>.<root_domain>)
  3. CNAME record (codex-cname-<suffix>.<root_domain>)
  4. Blank A record with no content/IP (codex-blank-a-<suffix>.<root_domain>)
  5. Blank AAAA record with no content/IP (codex-blank-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_overrides for dynu/dynu
  • DYNU_API_KEY exported, or dynu_api_key set in terraform.tfvars
  • A Dynu-managed root domain you control

Configure

cp terraform.tfvars.example terraform.tfvars

Edit terraform.tfvars and set at least:

  • dynu_root_domain
  • test_suffix (use a unique value per run)

Optional overrides include test_ipv4, test_ipv6, and test_cname_target.

Run

terraform init
terraform validate
terraform plan
terraform apply
terraform destroy

Notes

  • terraform apply should create all five record scenarios.
  • terraform destroy should remove all five records created by this state.
  • If you need to target a single scenario, resources are explicitly named:
    • dynu_dns_record.a_ipv4
    • dynu_dns_record.aaaa_ipv6
    • dynu_dns_record.cname
    • dynu_dns_record.blank_a
    • dynu_dns_record.blank_aaaa