Skip to content

Commit

Permalink
Merge branch 'main' into feature/spot-instance-enablement
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-niland authored Nov 27, 2024
2 parents b6ae4ad + 0572cc3 commit 1c0f892
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ Available targets:
| <a name="input_evaluation_periods"></a> [evaluation\_periods](#input\_evaluation\_periods) | The number of periods over which data is compared to the specified threshold. | `number` | `5` | no |
| <a name="input_external_network_interface_enabled"></a> [external\_network\_interface\_enabled](#input\_external\_network\_interface\_enabled) | Wheter to attach an external ENI as the eth0 interface for the instance. Any change to the interface will force instance recreation. | `bool` | `false` | no |
| <a name="input_external_network_interfaces"></a> [external\_network\_interfaces](#input\_external\_network\_interfaces) | The external interface definitions to attach to the instances. This depends on the instance type | <pre>list(object({<br/> delete_on_termination = bool<br/> device_index = number<br/> network_card_index = number<br/> network_interface_id = string<br/> }))</pre> | `null` | no |
| <a name="input_force_detach_ebs"></a> [force\_detach\_ebs](#input\_force\_detach\_ebs) | force the volume/s to detach from the instance. | `bool` | `false` | no |
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br/>Set to `0` for unlimited length.<br/>Set to `null` for keep the existing setting, which defaults to `0`.<br/>Does not affect `id_full`. | `number` | `null` | no |
| <a name="input_instance_initiated_shutdown_behavior"></a> [instance\_initiated\_shutdown\_behavior](#input\_instance\_initiated\_shutdown\_behavior) | Specifies whether an instance stops or terminates when you initiate shutdown from the instance. Can be one of 'stop' or 'terminate'. | `string` | `null` | no |
| <a name="input_instance_market_options"></a> [instance\_market\_options](#input\_instance\_market\_options) | Describes the market (purchasing) option for the instances.<br/>See [docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance#spot-options) for more information. | <pre>object({<br/> market_type = string<br/> spot_options = optional(object({<br/> instance_interruption_behavior = optional(string)<br/> max_price = optional(number)<br/> spot_instance_type = optional(string)<br/> valid_until = optional(string)<br/> }))<br/> })</pre> | `null` | no |
Expand Down Expand Up @@ -292,6 +293,7 @@ Available targets:
| <a name="input_ssm_patch_manager_s3_log_bucket"></a> [ssm\_patch\_manager\_s3\_log\_bucket](#input\_ssm\_patch\_manager\_s3\_log\_bucket) | The name of the s3 bucket to export the patch log to | `string` | `null` | no |
| <a name="input_stage"></a> [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
| <a name="input_statistic_level"></a> [statistic\_level](#input\_statistic\_level) | The statistic to apply to the alarm's associated metric. Allowed values are: SampleCount, Average, Sum, Minimum, Maximum | `string` | `"Maximum"` | no |
| <a name="input_stop_ec2_before_detaching_vol"></a> [stop\_ec2\_before\_detaching\_vol](#input\_stop\_ec2\_before\_detaching\_vol) | Set this to true to ensure that the target instance is stopped before trying to detach the volume/s. | `bool` | `false` | no |
| <a name="input_subnet"></a> [subnet](#input\_subnet) | VPC Subnet ID the instance is launched in | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br/>Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
| <a name="input_tenancy"></a> [tenancy](#input\_tenancy) | Tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of 'dedicated' runs on single-tenant hardware. The 'host' tenancy is not supported for the import-instance command. Valid values are 'default', 'dedicated', and 'host'. | `string` | `"default"` | no |
Expand Down
10 changes: 6 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,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 @@ -456,3 +456,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."
}

0 comments on commit 1c0f892

Please sign in to comment.