Skip to content

Commit

Permalink
refactor(dns_zone): improve regex comment and handle empty soa_record…
Browse files Browse the repository at this point in the history
… case in output
  • Loading branch information
rfernandezdo committed Oct 30, 2024
1 parent 95d0221 commit df0e2c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/networking/dns_zone/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ output "id" {
output "name" {
description = "The fully qualified domain name of the Record Set."

# This regex remove the last dot as the end
value = regex("(.+).", azurerm_dns_zone.dns_zone.soa_record[0].fqdn)[0]
# This regex removes the last dot at the end
value = length(azurerm_dns_zone.dns_zone.soa_record) > 0 ? regex("(.+).", azurerm_dns_zone.dns_zone.soa_record[0].fqdn)[0] : ""
}

output "resource_group_name" {
Expand Down

0 comments on commit df0e2c0

Please sign in to comment.