Sha256: a5147387eb4ce541b39d53d97f3f845a12925afad702953cc401acbb993ca713

Contents?: true

Size: 1.98 KB

Versions: 1

Compression:

Stored size: 1.98 KB

Contents

<% 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 %>"
    monitoring                  = <%= monitoring_state(instance) %>
    key_name                    = "<%= instance.key_name %>"
<%- if in_vpc?(instance) -%>
    subnet_id                   = "<%= instance.subnet_id %>"
    vpc_security_group_ids      = <%= instance.security_groups.map { |sg| sg.group_id }.inspect %>
<%- else -%>
    security_groups             = <%= instance.security_groups.map { |sg| sg.group_name }.inspect %>
<%- end -%>
    associate_public_ip_address = true
    private_ip                  = "<%= instance.private_ip_address %>"
    source_dest_check           = <%= instance.source_dest_check %>

<% block_devices_of(instance).each do |block_device| -%>
<%- mapping = block_device_mapping_of(instance, block_device.volume_id) -%>
<%- if root_block_device?(mapping, instance) -%>
    root_block_device {
        volume_type           = "<%= block_device.volume_type %>"
        volume_size           = <%= block_device.size %>
        iops                  = <%= block_device.iops %>
        delete_on_termination = <%= mapping.ebs.delete_on_termination %>
    }
<%- else -%>
    ebs_block_device {
        device_name           = "<%= mapping.device_name %>"
        snapshot_id           = "<%= block_device.snapshot_id %>"
        volume_type           = "<%= block_device.volume_type %>"
        volume_size           = <%= block_device.size %>
        iops                  = <%= block_device.iops %>
        delete_on_termination = <%= mapping.ebs.delete_on_termination %>
    }
<% end -%>

<% end -%>
    tags {
<% instance.tags.each do |tag| -%>
        "<%= tag.key %>" = "<%= tag.value %>"
<% end -%>
    }
}

<% end -%>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
terraforming-0.3.1 lib/terraforming/template/tf/ec2.erb