Skip to content

Conversation

@fd-jonathanlinn
Copy link
Contributor

@fd-jonathanlinn fd-jonathanlinn commented Nov 21, 2025

Description

Adds BuildkiteQueue and AgentsPerInstance tags to the AgentAutoscaleGroup resource, referencing the parameters of the same name. This makes it a little easier to correlate different resources in tools like Datadog, where you can now rely on a single Template Variable to filter EC2 instances and autoscaling Groups, as well as determining how many actual agents are running.

Deliberately set the tags not to propagate to the EC2 instances created by the ASG, as that tagging is handled by the LaunchTemplate.

Template changes validate fine using AWS CLI.

Checklist

  • Tests pass locally
  • Added tests for new features/fixes
  • Updated documentation (if applicable)
  • Linting checks pass

Release Notes

  • My changes affect the public API (variable renames, new stack parameters, etc)
    • I have added a note at the top of the release notes highlighting the API changes
  • Any changes to external libraries (agent, scaler function, etc) have been flagged in release notes

@fd-jonathanlinn fd-jonathanlinn marked this pull request as ready for review November 21, 2025 14:35
@fd-jonathanlinn fd-jonathanlinn requested a review from a team as a code owner November 21, 2025 14:35
Copy link

@amagana-fanduel amagana-fanduel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fd-jonathanlinn fd-jonathanlinn changed the title Add BuildkiteQueue tag to Agent Autoscaling groups Add BuildkiteQueue and AgentsPerInstance tags to Agent Autoscaling groups Nov 21, 2025
scadu
scadu previously requested changes Nov 24, 2025
Copy link
Contributor

@scadu scadu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, @fd-jonathanlinn!
The pipeline failed due to the issue with the template. From cfn-lint templates/*:

E3001 Additional properties are not allowed ('Tags' was unexpected)
templates/aws-stack.yml:2560:5

Moving Tags to the Properties block should fix the issue as now it's placed at the resource level alongside UpdatePolicy and CreationPolicy.
Moving the whole block to line 2553, just under NewInstancesProtectedFromScaleIn should fix it.

@scadu
Copy link
Contributor

scadu commented Nov 24, 2025

Looks like now the issue is related to the indentation. I should've mentioned that Tags is expected on the same level as NewInstancesProtectedFromScaleIn.

git diff with the correct indentation:

diff --git i/templates/aws-stack.yml w/templates/aws-stack.yml
index d901f4a7..d1e6f815 100644
--- i/templates/aws-stack.yml
+++ w/templates/aws-stack.yml
@@ -2550,13 +2550,13 @@ Resources:
         - OldestLaunchConfiguration
         - ClosestToNextInstanceHour
       NewInstancesProtectedFromScaleIn: !Ref InstanceScaleInProtection
-        Tags:
-          - Key: BuildkiteQueue
-            PropagateAtLaunch: false
-            Value: !Ref BuildkiteQueue
-          - Key: AgentsPerInstance
-            PropagateAtLaunch: false
-            Value: !Ref AgentsPerInstance
+      Tags:
+        - Key: BuildkiteQueue
+          PropagateAtLaunch: false
+          Value: !Ref BuildkiteQueue
+        - Key: AgentsPerInstance
+          PropagateAtLaunch: false
+          Value: !Ref AgentsPerInstance
     CreationPolicy:
       ResourceSignal:
         Timeout: !If [ UseDefaultInstanceCreationTimeout, !If [ UseWindowsAgents, PT10M, PT5M ], !Ref InstanceCreationTimeout ]

@JoeColeman95 JoeColeman95 merged commit a34fa56 into buildkite:main Nov 24, 2025
1 check passed
@fd-jonathanlinn fd-jonathanlinn deleted the feat/queue-name-asg-tag branch November 26, 2025 09:45
scadu added a commit to buildkite/terraform-buildkite-elastic-ci-stack-for-aws that referenced this pull request Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants