Skip to content

Commit bb822a1

Browse files
authored
fix: Fix Launch Templates error with aws 2.61.0 (#875)
1 parent a4e21e7 commit bb822a1

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

local.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ locals {
6868
suspended_processes = ["AZRebalance"] # A list of processes to suspend. i.e. ["AZRebalance", "HealthCheck", "ReplaceUnhealthy"]
6969
target_group_arns = null # A list of Application LoadBalancer (ALB) target group ARNs to be associated to the autoscaling group
7070
enabled_metrics = [] # A list of metrics to be collected i.e. ["GroupMinSize", "GroupMaxSize", "GroupDesiredCapacity"]
71-
placement_group = "" # The name of the placement group into which to launch the instances, if any.
71+
placement_group = null # The name of the placement group into which to launch the instances, if any.
7272
service_linked_role_arn = "" # Arn of custom service linked role that Auto Scaling group will use. Useful when you have encrypted EBS
7373
termination_policies = [] # A list of policies to decide how the instances in the auto scale group should be terminated.
7474
platform = "linux" # Platform of workers. either "linux" or "windows"
@@ -78,7 +78,7 @@ locals {
7878
root_kms_key_id = "" # The KMS key to use when encrypting the root storage device
7979
launch_template_version = "$Latest" # The lastest version of the launch template to use in the autoscaling group
8080
launch_template_placement_tenancy = "default" # The placement tenancy for instances
81-
launch_template_placement_group = "" # The name of the placement group into which to launch the instances, if any.
81+
launch_template_placement_group = null # The name of the placement group into which to launch the instances, if any.
8282
root_encrypted = false # Whether the volume should be encrypted or not
8383
eni_delete = true # Delete the Elastic Network Interface (ENI) on termination (if set to false you will have to manually delete before destroying)
8484
cpu_credits = "standard" # T2/T3 unlimited mode, can be 'standard' or 'unlimited'. Used 'standard' mode as default to avoid paying higher costs

workers_launch_template.tf

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,17 @@ resource "aws_launch_template" "workers_launch_template" {
294294
)
295295
}
296296

297-
placement {
298-
tenancy = lookup(
299-
var.worker_groups_launch_template[count.index],
300-
"launch_template_placement_tenancy",
301-
local.workers_group_defaults["launch_template_placement_tenancy"],
302-
)
303-
group_name = lookup(
304-
var.worker_groups_launch_template[count.index],
305-
"launch_template_placement_group",
306-
local.workers_group_defaults["launch_template_placement_group"],
307-
)
297+
dynamic placement {
298+
for_each = lookup(var.worker_groups_launch_template[count.index], "launch_template_placement_group", local.workers_group_defaults["launch_template_placement_group"]) != null ? [lookup(var.worker_groups_launch_template[count.index], "launch_template_placement_group", local.workers_group_defaults["launch_template_placement_group"])] : []
299+
300+
content {
301+
tenancy = lookup(
302+
var.worker_groups_launch_template[count.index],
303+
"launch_template_placement_tenancy",
304+
local.workers_group_defaults["launch_template_placement_tenancy"],
305+
)
306+
group_name = placement.value
307+
}
308308
}
309309

310310
dynamic instance_market_options {

0 commit comments

Comments
 (0)