{% extends "common/base_resource.tf.j2" %}
{% from "common/base_resource.tf.j2" import render_common_tags %}
{% block resources %}
{% for rg in resources %}
{{ resource_spacer() }}
resource "azurerm_resource_group" "{{ rg.name_sanitized }}" {
  name     = "{{ rg.name }}"
  location = "{{ rg.location }}"

  {% if rg.tags %}
  tags = {
    {% for key, value in rg.tags.items() %}
    "{{ key }}" = "{{ value }}"{{ "," if not loop.last }}
    {% endfor %}
  }
  {%  endif %}

  lifecycle {
    prevent_destroy = true
  }
}

{% endfor %}
{% endblock %}
