Skip to content

Commit 539ca68

Browse files
oavdeev-hsaknysh
authored andcommitted
make zone_id really optional (#13)
1 parent 14873bf commit 539ca68

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

main.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ resource "aws_security_group" "default" {
6565
}
6666

6767
data "aws_route53_zone" "domain" {
68+
count = "${var.zone_id != "" ? 1 : 0}"
6869
zone_id = "${var.zone_id}"
6970
}
7071

@@ -74,8 +75,8 @@ data "template_file" "user_data" {
7475
vars {
7576
user_data = "${join("\n", var.user_data)}"
7677
welcome_message = "${var.stage}"
77-
hostname = "${var.name}.${data.aws_route53_zone.domain.name}"
78-
search_domains = "${data.aws_route53_zone.domain.name}"
78+
hostname = "${var.name}.${join("",data.aws_route53_zone.domain.*.name)}"
79+
search_domains = "${join("",data.aws_route53_zone.domain.*.name)}"
7980
ssh_user = "${var.ssh_user}"
8081
}
8182
}
@@ -101,7 +102,9 @@ resource "aws_instance" "default" {
101102
}
102103

103104
module "dns" {
104-
source = "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.1.1"
105+
enabled = "${var.zone_id != "" ? true : false }"
106+
107+
source = "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.2.5"
105108
namespace = "${var.namespace}"
106109
name = "${var.name}"
107110
stage = "${var.stage}"

0 commit comments

Comments
 (0)