Skip to content
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
10 changes: 6 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ resource "aws_ebs_volume" "default" {
}

resource "aws_volume_attachment" "default" {
count = local.volume_count
device_name = var.ebs_device_name[count.index]
volume_id = aws_ebs_volume.default[count.index].id
instance_id = one(aws_instance.default[*].id)
count = local.volume_count
device_name = var.ebs_device_name[count.index]
volume_id = aws_ebs_volume.default[count.index].id
instance_id = one(aws_instance.default[*].id)
force_detach = var.force_detach_ebs
stop_instance_before_detaching = var.stop_ec2_before_detaching_vol
}
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -435,3 +435,15 @@ variable "external_network_interfaces" {
description = "The external interface definitions to attach to the instances. This depends on the instance type"
default = null
}

variable "force_detach_ebs" {
type = bool
default = false
description = "force the volume/s to detach from the instance."
}

variable "stop_ec2_before_detaching_vol" {
type = bool
default = false
description = "Set this to true to ensure that the target instance is stopped before trying to detach the volume/s."
}