{% extends "aws/base_resource.tf.j2" %}
{% block resources %}
{% for natgw in resources %}
{{ resource_spacer() }}
resource "aws_nat_gateway" "{{ natgw.name_sanitized }}" {
  {% if natgw.get('SubnetId') %}
  subnet_id = "{{ natgw.SubnetId }}"
  {%  endif %}

  {% if not natgw.is_private and natgw.get('primary_allocation_id') %}
  allocation_id = "{{ natgw.primary_allocation_id }}"
  {%  endif %}

  {% if natgw.get('ConnectivityType') %}
  connectivity_type = "{{ natgw.ConnectivityType }}"
  {%  endif %}

  {{ render_common_tags(natgw, indent=2) }}

  {% if not natgw.is_private %}
  depends_on = [aws_internet_gateway.igw]
  {%  endif %}
}

{% endfor %}
{% endblock %}
