Sha256: b58add646d4c61cd7b919820bacb6ed211c9783a05290790cbc2f1e89da9b84b

Contents?: true

Size: 1.91 KB

Versions: 7

Compression:

Stored size: 1.91 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 %>"
    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

7 entries across 7 versions & 1 rubygems

Version Path
terraforming-0.3.0 lib/terraforming/template/tf/ec2.erb
terraforming-0.2.0 lib/terraforming/template/tf/ec2.erb
terraforming-0.1.6 lib/terraforming/template/tf/ec2.erb
terraforming-0.1.5 lib/terraforming/template/tf/ec2.erb
terraforming-0.1.4 lib/terraforming/template/tf/ec2.erb
terraforming-0.1.3 lib/terraforming/template/tf/ec2.erb
terraforming-0.1.2 lib/terraforming/template/tf/ec2.erb