Skip to content

Commit 8db1f60

Browse files
damianrekoszDamian Rekosznpalm
authored
feat(runner-binaries-syncer): add s3_tags variable for additional S3 bucket tagging (#4832)
This pull request introduces an option to provide additional tags for S3 buckets created by the `binaries-syncer` module. S3 tags can be specified using the `runner_binaries_s3_tags` variable at the module level to apply tags to all S3 buckets at once, or at the individual runner configuration level to define different tags for specific runners. Tags defined at both the module and runner configuration levels are merged when their OS and architecture match. --------- Co-authored-by: Damian Rekosz <damian.rekosz@lcloud.pl> Co-authored-by: Niek Palm <npalm@users.noreply.github.com>
1 parent 2904a10 commit 8db1f60

File tree

6 files changed

+21
-1
lines changed

6 files changed

+21
-1
lines changed

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ module "runner_binaries" {
308308

309309
state_event_rule_binaries_syncer = var.state_event_rule_binaries_syncer
310310
server_side_encryption_configuration = var.runner_binaries_s3_sse_configuration
311+
s3_tags = var.runner_binaries_s3_tags
311312
s3_versioning = var.runner_binaries_s3_versioning
312313

313314
role_path = var.role_path

modules/multi-runner/runner-binaries.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ module "runner_binaries" {
2525
state_event_rule_binaries_syncer = var.state_event_rule_binaries_syncer
2626

2727
server_side_encryption_configuration = var.runner_binaries_s3_sse_configuration
28+
s3_tags = var.runner_binaries_s3_tags
2829
s3_versioning = var.runner_binaries_s3_versioning
2930

3031
role_path = var.role_path

modules/multi-runner/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,12 @@ variable "runner_binaries_s3_sse_configuration" {
404404
}
405405
}
406406

407+
variable "runner_binaries_s3_tags" {
408+
description = "Map of tags that will be added to the S3 bucket. Note these are additional tags to the default tags."
409+
type = map(string)
410+
default = {}
411+
}
412+
407413
variable "runner_binaries_s3_versioning" {
408414
description = "Status of S3 versioning for runner-binaries S3 bucket. Once set to Enabled the change cannot be reverted via Terraform!"
409415
type = string

modules/runner-binaries-syncer/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ locals {
55
resource "aws_s3_bucket" "action_dist" {
66
bucket = var.distribution_bucket_name
77
force_destroy = true
8-
tags = var.tags
8+
tags = merge(var.tags, var.s3_tags)
99
}
1010

1111
resource "aws_s3_bucket_ownership_controls" "this" {

modules/runner-binaries-syncer/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ variable "s3_logging_bucket_prefix" {
4545
}
4646
}
4747

48+
variable "s3_tags" {
49+
description = "Map of tags that will be added to the S3 bucket. Note these are additional tags to the default tags."
50+
type = map(string)
51+
default = {}
52+
}
53+
4854
variable "state_event_rule_binaries_syncer" {
4955
type = string
5056
description = "Option to disable EventBridge Lambda trigger for the binary syncer, useful to stop automatic updates of binary distribution"

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ variable "runner_binaries_s3_sse_configuration" {
192192
}
193193
}
194194

195+
variable "runner_binaries_s3_tags" {
196+
description = "Map of tags that will be added to the S3 bucket. Note these are additional tags to the default tags."
197+
type = map(string)
198+
default = {}
199+
}
200+
195201
variable "runner_binaries_s3_versioning" {
196202
description = "Status of S3 versioning for runner-binaries S3 bucket. Once set to Enabled the change cannot be reverted via Terraform!"
197203
type = string

0 commit comments

Comments
 (0)