{% extends "aws/base_resource.tf.j2" %}
{% block resources %}
{% for attachment in resources %}
{{ resource_spacer() }}
resource "aws_lb_target_group_attachment" "{{ attachment.name_sanitized }}" {
  target_group_arn = "{{ attachment.TargetGroupArn }}"
  target_id        = "{{ attachment.TargetId }}"

  {% if attachment.Port %}
  port             = {{ attachment.Port }}
  {%  endif %}

  {% if attachment.AvailabilityZone %}
  availability_zone = "{{ attachment.AvailabilityZone }}"
  {%  endif %}
}

{% endfor %}
{% endblock %}
