Skip to content

Commit 806bf58

Browse files
committed
fix: only tag spot rquests for spot
1 parent 78bb656 commit 806bf58

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

modules/runners/main.tf

+15-12
Original file line numberDiff line numberDiff line change
@@ -206,18 +206,21 @@ resource "aws_launch_template" "runner" {
206206
)
207207
}
208208

209-
tag_specifications {
210-
resource_type = "spot-instances-request"
211-
tags = merge(
212-
local.tags,
213-
{
214-
"Name" = format("%s", local.name_runner)
215-
},
216-
{
217-
"ghr:runner_name_prefix" = var.runner_name_prefix
218-
},
219-
var.runner_ec2_tags
220-
)
209+
dynamic "tag_specifications" {
210+
for_each = var.instance_target_capacity_type == "spot" ? 1 : 0
211+
content {
212+
resource_type = "spot-instances-request"
213+
tags = merge(
214+
local.tags,
215+
{
216+
"Name" = format("%s", local.name_runner)
217+
},
218+
{
219+
"ghr:runner_name_prefix" = var.runner_name_prefix
220+
},
221+
var.runner_ec2_tags
222+
)
223+
}
221224
}
222225

223226
tag_specifications {

0 commit comments

Comments
 (0)