Skip to content

Commit

Permalink
Adds private_zone option to data lookup (#19)
Browse files Browse the repository at this point in the history
This maintains current behaviour by defaulting to false.
  • Loading branch information
joshmyers authored and aknysh committed Jan 26, 2020
1 parent 60e5b32 commit 70d4bf5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Available targets:
| ipv6_enabled | Set to true to enable an AAAA DNS record to be set as well as the A record | bool | `false` | no |
| parent_zone_id | ID of the hosted zone to contain this record (or specify `parent_zone_name`) | string | `` | no |
| parent_zone_name | Name of the hosted zone to contain this record (or specify `parent_zone_id`) | string | `` | no |
| private_zone | Is this a private hosted zone? | bool | `false` | no |
| target_dns_name | DNS name of target resource (e.g. ALB, ELB) | string | - | yes |
| target_zone_id | ID of target resource (e.g. ALB, ELB) | string | - | yes |

Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
| ipv6_enabled | Set to true to enable an AAAA DNS record to be set as well as the A record | bool | `false` | no |
| parent_zone_id | ID of the hosted zone to contain this record (or specify `parent_zone_name`) | string | `` | no |
| parent_zone_name | Name of the hosted zone to contain this record (or specify `parent_zone_id`) | string | `` | no |
| private_zone | Is this a private hosted zone? | bool | `false` | no |
| target_dns_name | DNS name of target resource (e.g. ALB, ELB) | string | - | yes |
| target_zone_id | ID of target resource (e.g. ALB, ELB) | string | - | yes |

Expand Down
9 changes: 5 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
data "aws_route53_zone" "default" {
count = var.enabled ? signum(length(compact(var.aliases))) : 0
zone_id = var.parent_zone_id
name = var.parent_zone_name
count = var.enabled ? signum(length(compact(var.aliases))) : 0
zone_id = var.parent_zone_id
name = var.parent_zone_name
private_zone = var.private_zone
}

resource "aws_route53_record" "default" {
Expand All @@ -28,4 +29,4 @@ resource "aws_route53_record" "ipv6" {
zone_id = var.target_zone_id
evaluate_target_health = var.evaluate_target_health
}
}
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ variable "parent_zone_name" {
description = "Name of the hosted zone to contain this record (or specify `parent_zone_id`)"
}

variable "private_zone" {
type = bool
default = false
description = "Is this a private hosted zone?"
}

variable "target_dns_name" {
type = string
description = "DNS name of target resource (e.g. ALB, ELB)"
Expand Down

0 comments on commit 70d4bf5

Please sign in to comment.