Skip to content

add variable zone_id #1

Merged
merged 1 commit into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ logs
common/README.md

OLD/
X
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions a/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ module "db_cname" {
| <a name="input_ttl"></a> [ttl](#input\_ttl) | DNS RR Time To Live (ttl). Default 900s (15m). | `number` | `900` | no |
| <a name="input_values"></a> [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 |
| <a name="input_zone"></a> [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 |
| <a name="input_zone_id"></a> [zone\_id](#input\_zone\_id) | DNS Zone ID into which to create the record. | `string` | `null` | no |

## Outputs

Expand Down
2 changes: 1 addition & 1 deletion a/entry.tf
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions aaaa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ No modules.
| <a name="input_ttl"></a> [ttl](#input\_ttl) | DNS RR Time To Live (ttl). Default 900s (15m). | `number` | `900` | no |
| <a name="input_values"></a> [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 |
| <a name="input_zone"></a> [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 |
| <a name="input_zone_id"></a> [zone\_id](#input\_zone\_id) | DNS Zone ID into which to create the record. | `string` | `null` | no |

## Outputs

Expand Down
2 changes: 1 addition & 1 deletion aaaa/entry.tf
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/entry.tf
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/entry_heritage.tf
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
6 changes: 6 additions & 0 deletions common/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/version.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
locals {
_module_version = "1.0.4"
_module_version = "1.1.0"
}
2 changes: 2 additions & 0 deletions common/zone_forward.tf
Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions host/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ module "db_cname" {
| <a name="input_ttl"></a> [ttl](#input\_ttl) | DNS RR Time To Live (ttl). Default 900s (15m). | `number` | `900` | no |
| <a name="input_values"></a> [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 |
| <a name="input_zone"></a> [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 |
| <a name="input_zone_id"></a> [zone\_id](#input\_zone\_id) | DNS Zone ID into which to create the record. | `string` | `null` | no |

## Outputs

Expand Down
4 changes: 2 additions & 2 deletions host/entry.tf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down