{% set config = merged_configs.get('azurerm_dns_zone', {}) %}
{% set comments = compliance_comments.get('azurerm_dns_zone', []) %}
# ------------------------------------------------------------------------------
# Azure DNS Zone
# ------------------------------------------------------------------------------
{% for comment in comments %}
# {{ comment }}
{% endfor %}

resource "azurerm_dns_zone" "this" {
  name                = "{{ config.get('name', 'example.com') }}"
  resource_group_name = var.resource_group_name

  {% if config.get('soa_record') %}
  soa_record {
    email         = "{{ config.soa_record.get('email', 'admin.example.com') }}"
    expire_time   = {{ config.soa_record.get('expire_time', 2419200) }}
    minimum_ttl   = {{ config.soa_record.get('minimum_ttl', 300) }}
    refresh_time  = {{ config.soa_record.get('refresh_time', 3600) }}
    retry_time    = {{ config.soa_record.get('retry_time', 300) }}
    ttl           = {{ config.soa_record.get('ttl', 3600) }}
  }
  {% endif %}

  tags = {
    Name      = "{{ config.get('name', 'example.com') }}"
    ManagedBy = "complyform"
  }
}
