Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: instance refresh missing properties #121

Merged
merged 5 commits into from
Oct 20, 2023
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
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