Skip to content

Commit

Permalink
fix(multi-runner): Fix runner_additional_security_group_ids (#3352)
Browse files Browse the repository at this point in the history
If `runner_additional_security_group_ids` is only set outside the multi_runner_config `coalesce(each.value.runner_config.runner_additional_security_group_ids, var.runner_additional_security_group_ids)` is coalescing an empty list (the default value for `each.value.runner_config.runner_additional_security_group_ids`) with whatever is set outside the multi_runner_config, this always results in the returned value being an empty list:

```
> coalesce([], ["sg-123456"])
tolist([])

```

Using coalescelist instead returns the first non-empty list:

```
> coalescelist([], ["sg-123456"])
[
  "sg-123456",
]
```

And the `try` returns an empty list if both coalesced lists are empty (rather than throwing an error):

```
> try(coalescelist([], []), [])
[]
```
  • Loading branch information
dominicbr authored Jul 11, 2023
1 parent 6d018f6 commit 1f0c938
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/multi-runner/runners.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module "runners" {
idle_config = each.value.runner_config.idle_config
enable_ssm_on_runners = each.value.runner_config.enable_ssm_on_runners
egress_rules = var.runner_egress_rules
runner_additional_security_group_ids = coalesce(each.value.runner_config.runner_additional_security_group_ids, var.runner_additional_security_group_ids)
runner_additional_security_group_ids = try(coalescelist(each.value.runner_config.runner_additional_security_group_ids, var.runner_additional_security_group_ids), [])
metadata_options = each.value.runner_config.runner_metadata_options
credit_specification = each.value.runner_config.credit_specification

Expand Down

0 comments on commit 1f0c938

Please sign in to comment.