Skip to content

Commit

Permalink
fix: use tomap() instead of type declaration object() (terraform-aws-…
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleusb authored Nov 27, 2020
1 parent fad8086 commit be85f8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 6 additions & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@ module "records" {
},
]

depends_on = [module.zones] #, module.cloudfront, module.s3_bucket]
depends_on = [module.zones]
}

module "disabled_records" {
source = "../../modules/records"

create = false
}

#########
# Extras - should be created in advance
Expand Down
5 changes: 2 additions & 3 deletions modules/records/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ data "aws_route53_zone" "this" {
}

resource "aws_route53_record" "this" {
for_each = var.create && (var.zone_id != null || var.zone_name != null) ? local.recordsets : object({})
# for_each = local.recordsets
for_each = var.create && (var.zone_id != null || var.zone_name != null) ? local.recordsets : tomap({})

zone_id = data.aws_route53_zone.this[0].zone_id

Expand All @@ -26,7 +25,7 @@ resource "aws_route53_record" "this" {
for_each = length(keys(lookup(each.value, "alias", {}))) == 0 ? [] : [true]

content {
name = each.value.alias.name # module.api_gateway.this_apigatewayv2_domain_name_configuration.0.target_domain_name
name = each.value.alias.name
zone_id = each.value.alias.zone_id
evaluate_target_health = lookup(each.value.alias, "evaluate_target_health", false)
}
Expand Down

0 comments on commit be85f8a

Please sign in to comment.