File tree 2 files changed +18
-4
lines changed
2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -193,8 +193,10 @@ resource "aws_ebs_volume" "default" {
193
193
}
194
194
195
195
resource "aws_volume_attachment" "default" {
196
- count = local. volume_count
197
- device_name = var. ebs_device_name [count . index ]
198
- volume_id = aws_ebs_volume. default [count . index ]. id
199
- instance_id = one (aws_instance. default [* ]. id )
196
+ count = local. volume_count
197
+ device_name = var. ebs_device_name [count . index ]
198
+ volume_id = aws_ebs_volume. default [count . index ]. id
199
+ instance_id = one (aws_instance. default [* ]. id )
200
+ force_detach = var. force_detach_ebs
201
+ stop_instance_before_detaching = var. stop_ec2_before_detaching_vol
200
202
}
Original file line number Diff line number Diff line change @@ -435,3 +435,15 @@ variable "external_network_interfaces" {
435
435
description = " The external interface definitions to attach to the instances. This depends on the instance type"
436
436
default = null
437
437
}
438
+
439
+ variable "force_detach_ebs" {
440
+ type = bool
441
+ default = false
442
+ description = " force the volume/s to detach from the instance."
443
+ }
444
+
445
+ variable "stop_ec2_before_detaching_vol" {
446
+ type = bool
447
+ default = false
448
+ description = " Set this to true to ensure that the target instance is stopped before trying to detach the volume/s."
449
+ }
You can’t perform that action at this time.
0 commit comments