{% set config = merged_configs.get('aws_subnet', {}) %}
{% set comments = compliance_comments.get('aws_subnet', []) %}
# ------------------------------------------------------------------------------
# VPC Subnet
# ------------------------------------------------------------------------------
{% for comment in comments %}
# {{ comment }}
{% endfor %}

resource "aws_subnet" "this" {
  vpc_id            = aws_vpc.this.id
  cidr_block        = "{{ config.get('cidr_block', '10.0.1.0/24') }}"
  availability_zone = "{{ config.get('availability_zone', var.region ~ 'a') }}"

  map_public_ip_on_launch = {{ config.get('map_public_ip_on_launch', false) | lower }}

  tags = {
    Name      = "{{ config.get('name', project_id ~ '-subnet') }}"
    ManagedBy = "complyform"
  }
}
