Skip to content

fix: not try to tag spot requests when on-demand is set #4562

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

Merged
merged 3 commits into from
Apr 23, 2025
Merged
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
27 changes: 15 additions & 12 deletions modules/runners/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -206,18 +206,21 @@ resource "aws_launch_template" "runner" {
)
}

tag_specifications {
resource_type = "spot-instances-request"
tags = merge(
local.tags,
{
"Name" = format("%s", local.name_runner)
},
{
"ghr:runner_name_prefix" = var.runner_name_prefix
},
var.runner_ec2_tags
)
dynamic "tag_specifications" {
for_each = var.instance_target_capacity_type == "spot" ? [1] : [] # Include the block only if the value is "spot"
content {
resource_type = "spot-instances-request"
tags = merge(
local.tags,
{
"Name" = format("%s", local.name_runner)
},
{
"ghr:runner_name_prefix" = var.runner_name_prefix
},
var.runner_ec2_tags
)
}
}

tag_specifications {
Expand Down