<% instances.each do |instance| -%> resource "aws_instance" "<%= module_name_of(instance) %>" { ami = "<%= instance.image_id %>" availability_zone = "<%= instance.placement.availability_zone %>" ebs_optimized = <%= instance.ebs_optimized %> instance_type = "<%= instance.instance_type %>" key_name = "<%= instance.key_name %>" security_groups = <%= instance.security_groups.map { |sg| sg.group_id }.inspect %> subnet_id = "<%= instance.subnet_id %>" associate_public_ip_address = true private_ip = "<%= instance.private_ip_address %>" source_dest_check = <%= instance.source_dest_check %> <% instance.block_device_mappings.each do |block_device| -%> ebs_block_device { device_name = "<%= block_device.device_name %>" } <% end -%> tags { <% instance.tags.each do |tag| -%> <%= tag.key %> = "<%= tag.value %>" <% end -%> } } <% end -%>