Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
Generate iops field only with io1 volume
Browse files Browse the repository at this point in the history
  • Loading branch information
dtan4 committed Sep 20, 2016
1 parent 1615274 commit ce7bc35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/terraforming/template/tf/ec2.erb
Expand Up @@ -27,21 +27,21 @@ resource "aws_instance" "<%= module_name_of(instance) %>" {
root_block_device {
volume_type = "<%= block_device.volume_type %>"
volume_size = <%= block_device.size %>
<%- if block_device.iops -%>
delete_on_termination = <%= mapping.ebs.delete_on_termination %>
<%- if block_device.volume_type == "io1" && block_device.iops -%>
iops = <%= block_device.iops %>
<%- end -%>
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 %>
<%- if block_device.iops -%>
delete_on_termination = <%= mapping.ebs.delete_on_termination %>
<%- if block_device.volume_type == "io1" && block_device.iops -%>
iops = <%= block_device.iops %>
<%- end -%>
delete_on_termination = <%= mapping.ebs.delete_on_termination %>
}
<% end -%>
Expand Down
7 changes: 4 additions & 3 deletions spec/lib/terraforming/resource/ec2_spec.rb
Expand Up @@ -278,7 +278,8 @@ module Resource
delete_on_termination: true
}
],
volume_type: "standard",
volume_type: "io1",
iops: 24,
encrypted: false
}
]
Expand Down Expand Up @@ -332,9 +333,10 @@ module Resource
source_dest_check = true
root_block_device {
volume_type = "standard"
volume_type = "io1"
volume_size = 8
delete_on_termination = true
iops = 24
}
tags {
Expand All @@ -360,7 +362,6 @@ module Resource
snapshot_id = "snap-5678efgh"
volume_type = "gp2"
volume_size = 8
iops = 24
delete_on_termination = true
}
Expand Down

0 comments on commit ce7bc35

Please sign in to comment.