diff --git a/README.md b/README.md index 47e0c94..aabd976 100644 --- a/README.md +++ b/README.md @@ -342,8 +342,8 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply ### Contributors -| [![Erik Osterman][osterman_avatar]][osterman_homepage]
[Erik Osterman][osterman_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]
[Igor Rodionov][goruha_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]
[Andriy Knysh][aknysh_homepage] | [![Vladimir][SweetOps_avatar]][SweetOps_homepage]
[Vladimir][SweetOps_homepage] | -|---|---|---|---| +| [![Erik Osterman][osterman_avatar]][osterman_homepage]
[Erik Osterman][osterman_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]
[Igor Rodionov][goruha_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]
[Andriy Knysh][aknysh_homepage] | [![Vladimir][SweetOps_avatar]][SweetOps_homepage]
[Vladimir][SweetOps_homepage] | [![1david5][1david5_avatar]][1david5_homepage]
[1david5][1david5_homepage] | [![Yonatan Koren][korenyoni_avatar]][korenyoni_homepage]
[Yonatan Koren][korenyoni_homepage] | +|---|---|---|---|---|---| [osterman_homepage]: https://github.com/osterman @@ -354,6 +354,10 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply [aknysh_avatar]: https://img.cloudposse.com/150x150/https://github.com/aknysh.png [SweetOps_homepage]: https://github.com/SweetOps [SweetOps_avatar]: https://img.cloudposse.com/150x150/https://github.com/SweetOps.png + [1david5_homepage]: https://github.com/1david5 + [1david5_avatar]: https://img.cloudposse.com/150x150/https://github.com/1david5.png + [korenyoni_homepage]: https://github.com/korenyoni + [korenyoni_avatar]: https://img.cloudposse.com/150x150/https://github.com/korenyoni.png [![README Footer][readme_footer_img]][readme_footer_link] [![Beacon][beacon]][website] diff --git a/README.yaml b/README.yaml index 4748b66..ce7eb67 100644 --- a/README.yaml +++ b/README.yaml @@ -73,3 +73,7 @@ contributors: github: "aknysh" - name: "Vladimir" github: "SweetOps" + - name: "1david5" + github: "1david5" + - name: "Yonatan Koren" + github: "korenyoni" \ No newline at end of file diff --git a/main.tf b/main.tf index fd1e430..a8d9c4c 100644 --- a/main.tf +++ b/main.tf @@ -6,11 +6,11 @@ data "aws_route53_zone" "default" { } resource "aws_route53_record" "default" { + for_each = module.this.enabled ? toset(compact(var.aliases)) : [] #bridgecrew:skip=BC_AWS_NETWORKING_60:All of the aliases are configurable via var.aliases and it is the user's responsibility to ensure that all of the resources are in the same account. #bridgecrew:skip=BC_AWS_GENERAL_95:All of the aliases are configurable via var.aliases and it is the user's responsibility to ensure that all of the aliases point to resources and not just IPv4 addresses. - count = module.this.enabled ? length(compact(var.aliases)) : 0 zone_id = try(data.aws_route53_zone.default[0].zone_id, "") - name = compact(var.aliases)[count.index] + name = each.key allow_overwrite = var.allow_overwrite type = "A" @@ -22,9 +22,9 @@ resource "aws_route53_record" "default" { } resource "aws_route53_record" "ipv6" { - count = module.this.enabled && var.ipv6_enabled ? length(compact(var.aliases)) : 0 + for_each = module.this.enabled && var.ipv6_enabled ? toset(compact(var.aliases)) : [] zone_id = try(data.aws_route53_zone.default[0].zone_id, "") - name = compact(var.aliases)[count.index] + name = each.key allow_overwrite = var.allow_overwrite type = "AAAA" diff --git a/outputs.tf b/outputs.tf index eedb651..43ec9d9 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,5 +1,5 @@ output "hostnames" { - value = aws_route53_record.default.*.fqdn + value = try([for alias in var.aliases : aws_route53_record.default[alias].fqdn], []) description = "List of DNS records" }