Skip to content

Commit 0de6e63

Browse files
committed
feat: allows setting of SkipMatching for instance refreshing
1 parent 29d7d84 commit 0de6e63

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

functions/lambda.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class InstanceRefreshInProgress(LambdaError):
2626
LOGGING_LEVEL = environ.get('LOGGING_LEVEL', logging.INFO)
2727
REFRESH_INSTANCE_WARMUP = int(environ['REFRESH_INSTANCE_WARMUP'])
2828
REFRESH_MIN_HEALTHY_PERCENTAGE = int(environ['REFRESH_MIN_HEALTHY_PERCENTAGE'])
29+
REFRESH_SKIP_MATCHING = bool(environ['REFRESH_SKIP_MATCHING'])
2930
SENTRY_DSN = environ.get('SENTRY_DSN')
3031
SSM_PARAMETER_NAME = environ['SSM_PARAMETER_NAME']
3132
UPDATE_MIXED_INSTANCES_POLICY_OVERRIDEN_LAUNCH_TEMPLATES = bool(environ['UPDATE_MIXED_OVERRIDE_LAUNCH_TEMPLATES'])
@@ -163,6 +164,7 @@ def start_instance_refresh():
163164
Preferences={
164165
'InstanceWarmup': REFRESH_INSTANCE_WARMUP,
165166
'MinHealthyPercentage': REFRESH_MIN_HEALTHY_PERCENTAGE,
167+
'SkipMatching': REFRESH_SKIP_MATCHING,
166168
},
167169
)
168170
except autoscaling.exceptions.InstanceRefreshInProgressFault as ex:

lambda.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ resource "aws_lambda_function" "refresh" {
2626
DESCRIBE_INSTANCE_REFRESHES_MAX_RECORDS = var.describe_instance_refreshes_max_records
2727
REFRESH_INSTANCE_WARMUP = var.instance_refresh_instance_warmup
2828
REFRESH_MIN_HEALTHY_PERCENTAGE = var.instance_refresh_min_healthy_percentage
29+
REFRESH_SKIP_MATCHING = var.instance_refresh_skip_matching ? "True" : "False"
2930
SENTRY_DSN = var.sentry_dsn
3031
SENTRY_ENVIRONMENT = var.sentry_environment
3132
SSM_PARAMETER_NAME = var.ami_ssm_parameter

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ variable "instance_refresh_min_healthy_percentage" {
3939
type = number
4040
}
4141

42+
variable "instance_refresh_skip_matching" {
43+
description = "Skip matching instances for instance refresh"
44+
default = false
45+
type = bool
46+
}
47+
4248
variable "launch_template_version_description" {
4349
description = "Description of the new launch template version in Python's f-string format"
4450
default = "Automated AMI refresh to \"{image_id}\""

0 commit comments

Comments
 (0)