Skip to content

Commit

Permalink
Fix: instance refresh missing properties (#121)
Browse files Browse the repository at this point in the history
* Fix: instance refresh missing properties

* Added missing variables to the variables.tf file

* Change type to string instead of bool

* chore(fmt,readme): updated

---------

Co-authored-by: Jeremy White <[email protected]>
Co-authored-by: Jeremy White <[email protected]>
  • Loading branch information
3 people authored Oct 20, 2023
1 parent 4423705 commit 7bf4736
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Available targets:
| <a name="input_image_id"></a> [image\_id](#input\_image\_id) | The EC2 image ID to launch | `string` | `""` | no |
| <a name="input_instance_initiated_shutdown_behavior"></a> [instance\_initiated\_shutdown\_behavior](#input\_instance\_initiated\_shutdown\_behavior) | Shutdown behavior for the instances. Can be `stop` or `terminate` | `string` | `"terminate"` | no |
| <a name="input_instance_market_options"></a> [instance\_market\_options](#input\_instance\_market\_options) | The market (purchasing) option for the instances | <pre>object({<br> market_type = string<br> spot_options = optional(object({<br> block_duration_minutes = optional(number)<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 |
| <a name="input_instance_refresh"></a> [instance\_refresh](#input\_instance\_refresh) | The instance refresh definition | <pre>object({<br> strategy = string<br> preferences = optional(object({<br> instance_warmup = optional(number, null)<br> min_healthy_percentage = optional(number, null)<br> skip_matching = optional(bool, null)<br> auto_rollback = optional(bool, null)<br> }), null)<br> triggers = optional(list(string), [])<br> })</pre> | `null` | no |
| <a name="input_instance_refresh"></a> [instance\_refresh](#input\_instance\_refresh) | The instance refresh definition | <pre>object({<br> strategy = string<br> preferences = optional(object({<br> instance_warmup = optional(number, null)<br> min_healthy_percentage = optional(number, null)<br> skip_matching = optional(bool, null)<br> auto_rollback = optional(bool, null)<br> scale_in_protected_instances = optional(string, null)<br> standby_instances = optional(string, null)<br> }), null)<br> triggers = optional(list(string), [])<br> })</pre> | `null` | no |
| <a name="input_instance_reuse_policy"></a> [instance\_reuse\_policy](#input\_instance\_reuse\_policy) | If warm pool and this block are configured, instances in the Auto Scaling group can be returned to the warm pool on scale in. The default is to terminate instances in the Auto Scaling group when the group scales in. | <pre>object({<br> reuse_on_scale_in = bool<br> })</pre> | `null` | no |
| <a name="input_instance_type"></a> [instance\_type](#input\_instance\_type) | Instance type to launch | `string` | n/a | yes |
| <a name="input_key_name"></a> [key\_name](#input\_key\_name) | The SSH key name that should be used for the instance | `string` | `""` | no |
Expand Down
2 changes: 1 addition & 1 deletion docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
| <a name="input_image_id"></a> [image\_id](#input\_image\_id) | The EC2 image ID to launch | `string` | `""` | no |
| <a name="input_instance_initiated_shutdown_behavior"></a> [instance\_initiated\_shutdown\_behavior](#input\_instance\_initiated\_shutdown\_behavior) | Shutdown behavior for the instances. Can be `stop` or `terminate` | `string` | `"terminate"` | no |
| <a name="input_instance_market_options"></a> [instance\_market\_options](#input\_instance\_market\_options) | The market (purchasing) option for the instances | <pre>object({<br> market_type = string<br> spot_options = optional(object({<br> block_duration_minutes = optional(number)<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 |
| <a name="input_instance_refresh"></a> [instance\_refresh](#input\_instance\_refresh) | The instance refresh definition | <pre>object({<br> strategy = string<br> preferences = optional(object({<br> instance_warmup = optional(number, null)<br> min_healthy_percentage = optional(number, null)<br> skip_matching = optional(bool, null)<br> auto_rollback = optional(bool, null)<br> }), null)<br> triggers = optional(list(string), [])<br> })</pre> | `null` | no |
| <a name="input_instance_refresh"></a> [instance\_refresh](#input\_instance\_refresh) | The instance refresh definition | <pre>object({<br> strategy = string<br> preferences = optional(object({<br> instance_warmup = optional(number, null)<br> min_healthy_percentage = optional(number, null)<br> skip_matching = optional(bool, null)<br> auto_rollback = optional(bool, null)<br> scale_in_protected_instances = optional(string, null)<br> standby_instances = optional(string, null)<br> }), null)<br> triggers = optional(list(string), [])<br> })</pre> | `null` | no |
| <a name="input_instance_reuse_policy"></a> [instance\_reuse\_policy](#input\_instance\_reuse\_policy) | If warm pool and this block are configured, instances in the Auto Scaling group can be returned to the warm pool on scale in. The default is to terminate instances in the Auto Scaling group when the group scales in. | <pre>object({<br> reuse_on_scale_in = bool<br> })</pre> | `null` | no |
| <a name="input_instance_type"></a> [instance\_type](#input\_instance\_type) | Instance type to launch | `string` | n/a | yes |
| <a name="input_key_name"></a> [key\_name](#input\_key\_name) | The SSH key name that should be used for the instance | `string` | `""` | no |
Expand Down
10 changes: 6 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,12 @@ resource "aws_autoscaling_group" "default" {
dynamic "preferences" {
for_each = instance_refresh.value.preferences != null ? [instance_refresh.value.preferences] : []
content {
instance_warmup = lookup(preferences.value, "instance_warmup", null)
min_healthy_percentage = lookup(preferences.value, "min_healthy_percentage", null)
skip_matching = lookup(preferences.value, "skip_matching", null)
auto_rollback = lookup(preferences.value, "auto_rollback", null)
instance_warmup = lookup(preferences.value, "instance_warmup", null)
min_healthy_percentage = lookup(preferences.value, "min_healthy_percentage", null)
skip_matching = lookup(preferences.value, "skip_matching", null)
auto_rollback = lookup(preferences.value, "auto_rollback", null)
scale_in_protected_instances = lookup(preferences.value, "scale_in_protected_instances", null)
standby_instances = lookup(preferences.value, "standby_instances", null)
}
}
triggers = instance_refresh.value.triggers
Expand Down
10 changes: 6 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ variable "instance_refresh" {
type = object({
strategy = string
preferences = optional(object({
instance_warmup = optional(number, null)
min_healthy_percentage = optional(number, null)
skip_matching = optional(bool, null)
auto_rollback = optional(bool, null)
instance_warmup = optional(number, null)
min_healthy_percentage = optional(number, null)
skip_matching = optional(bool, null)
auto_rollback = optional(bool, null)
scale_in_protected_instances = optional(string, null)
standby_instances = optional(string, null)
}), null)
triggers = optional(list(string), [])
})
Expand Down

0 comments on commit 7bf4736

Please sign in to comment.