diff --git a/.gitignore b/.gitignore
index 1ae602b..14bd6d3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,4 @@ logs
common/README.md
OLD/
+X
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d5d88db..dbadd21 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,3 +15,6 @@
* 1.0.4 -- 2024-03-07
- update heritage_tags to pass the value
+
+* 1.1.0 -- 2024-10-17
+ - add zone_id to allow it to take a zone id directly vs from a lookup
diff --git a/a/README.md b/a/README.md
index 9145069..8f8a113 100644
--- a/a/README.md
+++ b/a/README.md
@@ -180,6 +180,7 @@ module "db_cname" {
| [ttl](#input\_ttl) | DNS RR Time To Live (ttl). Default 900s (15m). | `number` | `900` | no |
| [values](#input\_values) | DNS value to set for the name. May be a string or list of strings (like multiple IP addresses) | `any` | n/a | yes |
| [zone](#input\_zone) | DNS Zone into which to create the record. By default, it will extract this from the name after the first dot. | `string` | `null` | no |
+| [zone\_id](#input\_zone\_id) | DNS Zone ID into which to create the record. | `string` | `null` | no |
## Outputs
diff --git a/a/entry.tf b/a/entry.tf
index c9f5106..42515fc 100644
--- a/a/entry.tf
+++ b/a/entry.tf
@@ -1,6 +1,6 @@
resource "aws_route53_record" "entry" {
count = length(local.ipv4_hosts) > 0 ? 1 : 0
- zone_id = data.aws_route53_zone.zone.zone_id
+ zone_id = var.zone_id != null ? data.aws_route53_zone.zone[0].zone_id : var.zone_id
name = var.name
type = local.rr_type
ttl = var.ttl
diff --git a/aaaa/README.md b/aaaa/README.md
index e998475..a646ac7 100644
--- a/aaaa/README.md
+++ b/aaaa/README.md
@@ -170,6 +170,7 @@ No modules.
| [ttl](#input\_ttl) | DNS RR Time To Live (ttl). Default 900s (15m). | `number` | `900` | no |
| [values](#input\_values) | DNS value to set for the name. May be a string or list of strings (like multiple IP addresses) | `any` | n/a | yes |
| [zone](#input\_zone) | DNS Zone into which to create the record. By default, it will extract this from the name after the first dot. | `string` | `null` | no |
+| [zone\_id](#input\_zone\_id) | DNS Zone ID into which to create the record. | `string` | `null` | no |
## Outputs
diff --git a/aaaa/entry.tf b/aaaa/entry.tf
index ba8cce4..7e118de 100644
--- a/aaaa/entry.tf
+++ b/aaaa/entry.tf
@@ -1,6 +1,6 @@
resource "aws_route53_record" "entry" {
count = length(local.ipv6_hosts) > 0 ? 1 : 0
- zone_id = data.aws_route53_zone.zone.zone_id
+ zone_id = var.zone_id != null ? data.aws_route53_zone.zone[0].zone_id : var.zone_id
name = var.name
type = local.rr_type
ttl = var.ttl
diff --git a/common/entry.tf b/common/entry.tf
index 322639f..75bf973 100644
--- a/common/entry.tf
+++ b/common/entry.tf
@@ -1,5 +1,5 @@
resource "aws_route53_record" "entry" {
- zone_id = data.aws_route53_zone.zone.zone_id
+ zone_id = var.zone_id != null ? data.aws_route53_zone.zone[0].zone_id : var.zone_id
name = var.name
type = local.rr_type
ttl = var.ttl
diff --git a/common/entry_heritage.tf b/common/entry_heritage.tf
index 4312db3..6e8e9aa 100644
--- a/common/entry_heritage.tf
+++ b/common/entry_heritage.tf
@@ -1,6 +1,6 @@
resource "aws_route53_record" "entry_heritage" {
count = var.enable_heritage ? 1 : 0
- zone_id = data.aws_route53_zone.zone.zone_id
+ zone_id = var.zone_id != null ? data.aws_route53_zone.zone[0].zone_id : var.zone_id
name = format("%v%v", local.default_heritage_prefix, var.name)
type = "TXT"
diff --git a/common/variables.tf b/common/variables.tf
index d04b114..3e57859 100644
--- a/common/variables.tf
+++ b/common/variables.tf
@@ -4,6 +4,12 @@ variable "zone" {
default = null
}
+variable "zone_id" {
+ description = "DNS Zone ID into which to create the record."
+ type = string
+ default = null
+}
+
variable "name" {
description = "FQDN DNS name to create. If the zone (everything after the first dot) does not exist or is not associated to the VPC, this creation will fail."
type = string
diff --git a/common/version.tf b/common/version.tf
index 4840281..9c489cd 100644
--- a/common/version.tf
+++ b/common/version.tf
@@ -1,3 +1,3 @@
locals {
- _module_version = "1.0.4"
+ _module_version = "1.1.0"
}
diff --git a/common/zone_forward.tf b/common/zone_forward.tf
index 15c1533..faa0bb2 100644
--- a/common/zone_forward.tf
+++ b/common/zone_forward.tf
@@ -1,5 +1,7 @@
# if the zone grab fails here, it either doesn't exist or it is not associated with this VPC
+# if zone_id passed, do not try to use the zone
data "aws_route53_zone" "zone" {
+ count = var.zone_id != null ? 1 : 0
name = local.zone
private_zone = local.private_zone
}
diff --git a/host/README.md b/host/README.md
index c38b9e4..3333ab7 100644
--- a/host/README.md
+++ b/host/README.md
@@ -178,6 +178,7 @@ module "db_cname" {
| [ttl](#input\_ttl) | DNS RR Time To Live (ttl). Default 900s (15m). | `number` | `900` | no |
| [values](#input\_values) | DNS value to set for the name. May be a string or list of strings (like multiple IP addresses) | `any` | n/a | yes |
| [zone](#input\_zone) | DNS Zone into which to create the record. By default, it will extract this from the name after the first dot. | `string` | `null` | no |
+| [zone\_id](#input\_zone\_id) | DNS Zone ID into which to create the record. | `string` | `null` | no |
## Outputs
diff --git a/host/entry.tf b/host/entry.tf
index c1494c3..2e9eef3 100644
--- a/host/entry.tf
+++ b/host/entry.tf
@@ -1,6 +1,6 @@
resource "aws_route53_record" "entry_ipv4" {
count = length(local.ipv4_hosts) > 0 ? 1 : 0
- zone_id = data.aws_route53_zone.zone.zone_id
+ zone_id = var.zone_id != null ? data.aws_route53_zone.zone[0].zone_id : var.zone_id
name = var.name
type = "A"
ttl = var.ttl
@@ -9,7 +9,7 @@ resource "aws_route53_record" "entry_ipv4" {
resource "aws_route53_record" "entry_ipv6" {
count = length(local.ipv6_hosts) > 0 ? 1 : 0
- zone_id = data.aws_route53_zone.zone.zone_id
+ zone_id = var.zone_id != null ? data.aws_route53_zone.zone[0].zone_id : var.zone_id
name = var.name
type = "AAAA"
ttl = var.ttl