feat(logging): add log_class parameter to runner log files configuration#5036
feat(logging): add log_class parameter to runner log files configuration#5036
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
@Brend-Smits did you run a quick check on the multi-runner as well default example? Please can you also update all other log groups managed by the module? See https://github.com/github-aws-runners/terraform-aws-github-runner/search?q=repo%3Agithub-aws-runners%2Fterraform-aws-github-runner%20path%3A*.tf%20resource%20%22aws_cloudwatch_log_group%22&type=code |
Yes I tested this with the multi runner example and it works as advertised. As expected, when you change the log class for existing log groups, it forces a replacement on the whole group. I also updated it for all the other modules. |
c70da8b to
5820b11
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a log_class parameter throughout the Terraform module, enabling users to configure CloudWatch log groups to use either the STANDARD or INFREQUENT_ACCESS class (defaulting to STANDARD). This affects lambda function log groups, runner EC2 instance log groups, and per-log-file CloudWatch log groups configured via runner_log_files.
Changes:
- New
log_classvariable added to all relevant modules (root, runners, multi-runner, webhook, ami-housekeeper, runner-binaries-syncer) with validation, and propagated through all module call chains - Runner EC2 instance log groups refactored from
count-based tofor_each-based resource indexing (to support per-log-group class configuration), and each default log file entry now hardcodeslog_class = "STANDARD" runner_log_filesandmulti_runner_config.runner_log_filestype objects updated with an optionallog_classfield, and all CloudWatch log group resources updated withlog_group_class = var.log_class(or equivalent)
Reviewed changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
variables.tf |
Adds root-level log_class variable with validation; adds log_class to runner_log_files object type |
main.tf |
Propagates log_class to all child module calls |
modules/runners/variables.tf |
Adds log_class variable with validation; updates runner_log_files description and type |
modules/runners/logging.tf |
Adds log_class to default log files; refactors count → for_each for log groups; uses per-entry class |
modules/runners/pool.tf / pool/main.tf / pool/variables.tf |
Passes log_class through to the pool lambda log group |
modules/runners/scale-up.tf / scale-down.tf / ssm-housekeeper.tf |
Applies log_group_class = var.log_class to lambda log groups |
modules/lambda/variables.tf / main.tf |
Adds optional log_class to lambda config object; applies to log group resource |
modules/webhook/ (webhook, direct, eventbridge) |
Adds log_class to config objects and applies to CloudWatch log groups |
modules/runner-binaries-syncer/ |
Adds log_class variable and applies to syncer log group |
modules/ami-housekeeper/ |
Adds log_class variable and applies to housekeeper log group |
modules/termination-watcher/variables.tf |
Adds log_class to the config object (flows to lambda module) |
modules/multi-runner/ |
Adds log_class variable; propagates to all child modules including runner_log_files in multi_runner_config |
README.md files |
Documentation updates reflecting new log_class variable in all modules |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
75ddb43 to
4c57614
Compare
Extends the log_class parameter to all CloudWatch log groups managed by the module, allowing users to set INFREQUENT_ACCESS class to reduce costs. Log groups updated: - runner-binaries-syncer (syncer) - ami-housekeeper - runners (scale-down, scale-up, ssm-housekeeper) - runners/pool - webhook/direct - webhook/eventbridge (webhook, dispatcher) - lambda module (shared) - termination-watcher - multi-runner (passthrough to all submodules) Defaults to STANDARD for backward compatibility.
BREAKING CHANGE AVOIDED: The previous implementation changed aws_cloudwatch_log_group.gh_runners from count to for_each, which would cause Terraform to destroy and recreate all existing CloudWatch log groups on upgrade. This could result in loss of log data. This commit reverts to the count-based approach using parallel loggroups_names and loggroups_classes lists, preserving the existing Terraform state addresses (e.g. aws_cloudwatch_log_group.gh_runners[0]) while still supporting the new log_class parameter. Changes: - logging.tf: Use loggroups_names + loggroups_classes parallel lists instead of a for_each on objects, keeping count-based resource indexing - logging.tf: Remove redundant try() around l.log_class since the variable type already defaults it to "STANDARD" - job-retry.tf: Add missing log_class propagation to job-retry config - variables.tf: Update runner_log_files description to document log_class - examples/multi-runner: Add log_class parameter to example Signed-off-by: Brend Smits <brend.smits@philips.com>
4c57614 to
1571bdd
Compare
npalm
left a comment
There was a problem hiding this comment.
@Brend-Smits thx LGTM. Problem with destroying log groups seems solved.
🤖 I have created a release *beep* *boop* --- ## [7.5.0](v7.4.1...v7.5.0) (2026-03-11) ### Features * **lambdas:** add batch SSM parameter fetching to reduce API calls ([#5017](#5017)) ([24857c2](24857c2)) * **logging:** add log_class parameter to runner log files configuration ([#5036](#5036)) ([3509d4c](3509d4c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: runners-releaser[bot] <194412594+runners-releaser[bot]@users.noreply.github.com>
This pull request updates the logging configuration by introducing support for the
log_classproperty, allowing log groups to be created with either theSTANDARDorINFREQUENT_ACCESSclass. The change is applied throughout the configuration to ensure log groups and log files can specify their class, defaulting toSTANDARDif not set.Logging configuration enhancements:
log_classproperty (defaulting to"STANDARD") to therunner_log_filesandmulti_runner_configvariables invariables.tf,modules/runners/variables.tf, andmodules/multi-runner/variables.tfto allow specifying the log group class. [1] [2] [3]modules/runners/logging.tfto include thelog_classproperty for each log file, defaulting to"STANDARD".modules/runners/logging.tfto use the specifiedlog_classwhen creating log groups, and refactored the logic to group log files by both name and class.Documentation improvements:
runner_log_filesvariable to document the newlog_classproperty and its valid values.