Skip to content

Commit f200e69

Browse files
authored
EKS Actions Runner Controller: Include Context Tags as Labels (cloudposse/terraform-aws-components#918)
1 parent 6eea327 commit f200e69

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ Consult [actions-runner-controller](https://github.com/actions-runner-controller
443443
| <a name="input_chart_version"></a> [chart\_version](#input\_chart\_version) | Specify the exact chart version to install. If this is not specified, the latest version is installed. | `string` | `null` | no |
444444
| <a name="input_cleanup_on_fail"></a> [cleanup\_on\_fail](#input\_cleanup\_on\_fail) | Allow deletion of new resources created in this upgrade when upgrade fails. | `bool` | `true` | no |
445445
| <a name="input_context"></a> [context](#input\_context) | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "descriptor_formats": {},<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "labels_as_tags": [<br> "unset"<br> ],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {},<br> "tenant": null<br>}</pre> | no |
446+
| <a name="input_context_tags_enabled"></a> [context\_tags\_enabled](#input\_context\_tags\_enabled) | Whether or not to include all context tags as labels for each runner | `bool` | `false` | no |
446447
| <a name="input_create_namespace"></a> [create\_namespace](#input\_create\_namespace) | Create the namespace if it does not yet exist. Defaults to `false`. | `bool` | `null` | no |
447448
| <a name="input_delimiter"></a> [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
448449
| <a name="input_descriptor_formats"></a> [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.<br>Map of maps. Keys are names of descriptors. Values are maps of the form<br>`{<br> format = string<br> labels = list(string)<br>}`<br>(Type is `any` so the map values can later be enhanced to provide additional options.)<br>`format` is a Terraform format string to be passed to the `format()` function.<br>`labels` is a list of labels, in order, to pass to `format()` function.<br>Label values will be normalized before being passed to `format()` so they will be<br>identical to how they appear in `id`.<br>Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no |

src/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
locals {
2-
enabled = module.this.enabled
2+
enabled = module.this.enabled
3+
context_labels = var.context_tags_enabled ? values(module.this.tags) : []
34

45
webhook_enabled = local.enabled ? try(var.webhook.enabled, false) : false
56
webhook_host = local.webhook_enabled ? format(var.webhook.hostname_template, var.tenant, var.stage, var.environment) : "example.com"
@@ -223,7 +224,7 @@ module "actions_runner" {
223224
service_account_role_arn = module.actions_runner_controller.service_account_role_arn
224225
resources = each.value.resources
225226
storage = each.value.storage
226-
labels = each.value.labels
227+
labels = concat(each.value.labels, local.context_labels)
227228
scale_down_delay_seconds = each.value.scale_down_delay_seconds
228229
min_replicas = each.value.min_replicas
229230
max_replicas = each.value.max_replicas

src/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,9 @@ variable "ssm_github_webhook_secret_token_path" {
268268
description = "The path in SSM to the GitHub Webhook Secret token."
269269
default = ""
270270
}
271+
272+
variable "context_tags_enabled" {
273+
type = bool
274+
description = "Whether or not to include all context tags as labels for each runner"
275+
default = false
276+
}

0 commit comments

Comments
 (0)