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

Generate iops field only with io1 volume #271

Merged
merged 1 commit into from
Sep 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/terraforming/template/tf/ec2.erb
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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