Archived
Rename dns record state field to enabled
This commit is contained in:
@@ -6,9 +6,9 @@ This example is an **opt-in live test** for writable Dynu provider functionality
|
||||
|
||||
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>`)
|
||||
1. `A` record with IPv4 content, `location`, and minimum TTL=90 (`codex-a-<suffix>.<root_domain>`)
|
||||
2. `AAAA` record with IPv6 content and `location` (`codex-aaaa-<suffix>.<root_domain>`)
|
||||
3. `CNAME` record created disabled (`enabled = false`) (`codex-cname-<suffix>.<root_domain>`)
|
||||
4. **Dynamic `A` record** with omitted content (`codex-dynamic-a-<suffix>.<root_domain>`)
|
||||
5. **Dynamic `AAAA` record** with omitted content (`codex-dynamic-aaaa-<suffix>.<root_domain>`)
|
||||
|
||||
@@ -32,7 +32,10 @@ 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`. Use real routable IPs for `test_ipv4`/`test_ipv6`; Dynu rejects documentation ranges such as `192.0.2.0/24` and `2001:db8::/32`.
|
||||
Optional overrides include `test_ipv4`, `test_ipv6`, `test_cname_target`, `test_ttl`, and `test_location`.
|
||||
|
||||
- `test_ttl` must be `0` (provider/API default) or `>= 90`.
|
||||
- `test_location` applies only to A/AAAA records.
|
||||
|
||||
## Run
|
||||
|
||||
@@ -46,7 +49,7 @@ terraform destroy
|
||||
|
||||
## Notes
|
||||
|
||||
- `terraform apply` should create all five record scenarios.
|
||||
- `terraform apply` should create all five record scenarios (including a disabled CNAME example).
|
||||
- `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`
|
||||
|
||||
@@ -17,8 +17,9 @@ resource "dynu_dns_record" "a_ipv4" {
|
||||
hostname = local.hostname_a_ipv4
|
||||
record_type = "A"
|
||||
content = var.test_ipv4
|
||||
ttl = var.test_ttl
|
||||
state = true
|
||||
ttl = 90
|
||||
enabled = true
|
||||
location = var.test_location
|
||||
}
|
||||
|
||||
resource "dynu_dns_record" "aaaa_ipv6" {
|
||||
@@ -26,7 +27,8 @@ resource "dynu_dns_record" "aaaa_ipv6" {
|
||||
record_type = "AAAA"
|
||||
content = var.test_ipv6
|
||||
ttl = var.test_ttl
|
||||
state = true
|
||||
enabled = true
|
||||
location = var.test_location
|
||||
}
|
||||
|
||||
resource "dynu_dns_record" "cname" {
|
||||
@@ -34,7 +36,7 @@ resource "dynu_dns_record" "cname" {
|
||||
record_type = "CNAME"
|
||||
content = var.test_cname_target
|
||||
ttl = var.test_ttl
|
||||
state = true
|
||||
enabled = false
|
||||
}
|
||||
|
||||
# Deliberate dynamic A record scenario: content intentionally omitted for Dynu dynamic IPv4 behavior.
|
||||
@@ -42,7 +44,7 @@ resource "dynu_dns_record" "dynamic_a" {
|
||||
hostname = local.hostname_dynamic_a
|
||||
record_type = "A"
|
||||
ttl = var.test_ttl
|
||||
state = true
|
||||
enabled = true
|
||||
}
|
||||
|
||||
# Deliberate dynamic AAAA record scenario: content intentionally omitted for Dynu dynamic IPv6 behavior.
|
||||
@@ -50,5 +52,5 @@ resource "dynu_dns_record" "dynamic_aaaa" {
|
||||
hostname = local.hostname_dynamic_aaaa
|
||||
record_type = "AAAA"
|
||||
ttl = var.test_ttl
|
||||
state = true
|
||||
enabled = true
|
||||
}
|
||||
|
||||
@@ -14,3 +14,4 @@ test_ipv6 = "2001:db8::123"
|
||||
test_cname_target = "example.com"
|
||||
|
||||
test_ttl = 300
|
||||
test_location = "us"
|
||||
|
||||
@@ -60,7 +60,13 @@ variable "test_cname_target" {
|
||||
}
|
||||
|
||||
variable "test_ttl" {
|
||||
description = "TTL in seconds for disposable DNS records."
|
||||
description = "TTL in seconds for disposable DNS records. Must be 0 (provider/API default) or >= 90."
|
||||
type = number
|
||||
default = 300
|
||||
}
|
||||
|
||||
variable "test_location" {
|
||||
description = "Optional Dynu location hint for A/AAAA records."
|
||||
type = string
|
||||
default = "us"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user