lib/terraforming/template/tf/security_group.erb in terraforming-0.1.2 vs lib/terraforming/template/tf/security_group.erb in terraforming-0.1.3

- old
+ new

@@ -2,11 +2,11 @@ resource "aws_security_group" "<%= module_name_of(security_group) %>" { name = "<%= security_group.group_name %>" description = "<%= security_group.description %>" vpc_id = "<%= security_group.vpc_id || '' %>" -<% security_group.ip_permissions.each do |permission| -%> +<% dedup_permissions(security_group).ip_permissions.each do |permission| -%> <%- security_groups = security_groups_in(permission).reject { |group_id| group_id == security_group.group_id } -%> ingress { from_port = <%= permission.from_port || 0 %> to_port = <%= permission.to_port || 0 %> protocol = "<%= permission.ip_protocol %>" @@ -22,10 +22,10 @@ <%- end -%> } <% end -%> -<% security_group.ip_permissions_egress.each do |permission| -%> +<% dedup_permissions(security_group).ip_permissions_egress.each do |permission| -%> egress { from_port = <%= permission.from_port || 0 %> to_port = <%= permission.to_port || 0 %> protocol = "<%= permission.ip_protocol %>" <%- if permission.ip_ranges.length > 0 -%>