lib/terraforming/template/tf/ec2.erb in terraforming-0.1.1 vs lib/terraforming/template/tf/ec2.erb in terraforming-0.1.2
- old
+ new
@@ -3,19 +3,38 @@
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 %>"
- security_groups = <%= instance.security_groups.map { |sg| sg.group_id }.inspect %>
+<%- 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 %>
-<% instance.block_device_mappings.each do |block_device| -%>
+<% 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 = "<%= block_device.device_name %>"
+ 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 %>"