<% iam_instance_profiles.each do |profile| -%> resource "aws_iam_instance_profile" "<%= module_name_of(profile) %>" { name = "<%= profile.instance_profile_name %>" path = "<%= profile.path %>" role = "<%= profile.roles[0].role_name %>" } <% end -%>