Skip to content

Commit

Permalink
refactor(Update syntax for T.F 0.12.x): Update syntax for T.F 0.12.x …
Browse files Browse the repository at this point in the history
…compatibility
  • Loading branch information
diego committed Jul 29, 2019
1 parent 8b484a7 commit 4bfedef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ resource "aws_route53_zone" "this" {
resource "aws_route53_record" "this" {
depends_on = ["aws_route53_zone.this"]
count = "${var.zone_id == "false" && length(var.records["names"]) > 0 ? length(var.records["names"]) : 0}"
zone_id = "${var.zone_id != "false" ? var.zone_id : aws_route53_zone.this.zone_id}"
zone_id = "${var.zone_id != "false" ? var.zone_id : aws_route53_zone.this.0.zone_id}"
name = "${element(var.records["names"], count.index)}${var.domain}"
type = "${element(var.records["types"], count.index)}"
ttl = "${element(var.records["ttls"], count.index)}"
records = ["${split(",", element(var.records["values"], count.index))}"]
records = "${split(",", element(var.records["values"], count.index))}"
}

resource "aws_route53_record" "alias" {
depends_on = ["aws_route53_zone.this"]
count = "${var.zone_id == "false" && length(var.alias["names"]) > 0 ? length(var.alias["names"]) : 0}"
zone_id = "${var.zone_id != "false" ? var.zone_id : aws_route53_zone.this.zone_id}"
zone_id = "${var.zone_id != "false" ? var.zone_id : aws_route53_zone.this.0.zone_id}"
name = "${element(var.alias["names"], count.index)}${var.domain}"
type = "A"

Expand All @@ -38,7 +38,7 @@ resource "aws_route53_record" "imported" {
name = "${element(var.records["names"], count.index)}${var.domain}"
type = "${element(var.records["types"], count.index)}"
ttl = "${element(var.records["ttls"], count.index)}"
records = ["${split(",", element(var.records["values"], count.index))}"]
records = "${split(",", element(var.records["values"], count.index))}"
}

resource "aws_route53_record" "alias_imported" {
Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ variable "zone_id" {


variable "records" {
type = "map"
type = any
description = "List of DNS Records to add to the DNS zone"
default = {
names = []
Expand All @@ -25,7 +25,7 @@ variable "records" {
}

variable "alias" {
type = "map"
type = any
description = "List of DNS Aliases to add to the DNS zone"
default = {
names = []
Expand Down

0 comments on commit 4bfedef

Please sign in to comment.