Sha256: 3bdff9be772ef30c9f088f175338a213d22b411b2f16890c3c01fedc67c6f3c2

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 KB

Contents

<% security_groups.each do |security_group| -%>
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| -%>
    ingress {
        from_port       = <%= permission.from_port || 0 %>
        to_port         = <%= permission.to_port || 0 %>
        protocol        = "<%= permission.ip_protocol %>"
<%- if permission.ip_ranges.length > 0 -%>
        cidr_blocks     = <%= permission.ip_ranges.map { |range| range.cidr_ip }.inspect %>
<%- end -%>
<%- if permission.user_id_group_pairs.length > 0 -%>
        security_groups = <%= permission.user_id_group_pairs.map { |range| range.group_id }.inspect %>
<%- end -%>
    }

<% end -%>

<% 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 -%>
        cidr_blocks     = <%= permission.ip_ranges.map { |range| range.cidr_ip }.inspect %>
<%- end -%>
<%- if permission.user_id_group_pairs.length > 0 -%>
        security_groups = <%= permission.user_id_group_pairs.map { |range| range.group_id }.inspect %>
<%- end -%>
    }

<% end -%>
<% if security_group.tags.length > 0 -%>
    tags {
<% security_group.tags.each do |tag| -%>
        <%= tag.key %> = "<%= tag.value %>"
<% end -%>
    }
<% end -%>
}

<% end -%>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
terraforming-0.0.4 lib/terraforming/template/tf/security_group.erb