Skip to content

Commit

Permalink
feat: support record.key entries (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
aldoborrero authored Oct 14, 2022
1 parent 85e7410 commit 0b2bf64
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ locals {
records_enabled = module.this.enabled && length(var.records) > 0
zone_id = local.zone_enabled ? join("", cloudflare_zone.default.*.id) : (local.zone_exists ? lookup(data.cloudflare_zones.default[0].zones[0], "id") : null)
records = local.records_enabled ? {
for record in flatten(var.records) :
format("%s%s",
record.name,
record.type,
) => record
for index, record in flatten(var.records) :
try(record.key, format("%s-%s", record.name, record.type)) => record
} : {}
}

Expand Down
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ output "record_hostnames_to_ids" {
description = "A map of the zone record hostnames to IDs."
value = {
for record in cloudflare_record.default :
record.hostname => record.id
record.hostname => record.id...
if local.records_enabled
}
}
Expand Down

0 comments on commit 0b2bf64

Please sign in to comment.