Skip to content

fix(runners): fix type mismatch in pool role conditional#5156

Merged
Brend-Smits merged 2 commits into
mainfrom
fix/pool-role-type-mismatch
Jun 11, 2026
Merged

fix(runners): fix type mismatch in pool role conditional#5156
Brend-Smits merged 2 commits into
mainfrom
fix/pool-role-type-mismatch

Conversation

@Brend-Smits

Copy link
Copy Markdown
Contributor

Problem

The conditional for the runner role in modules/runners/pool.tf (introduced in #4875) returns inconsistent types:

role = var.iam_overrides["override_runner_role"] ? { arn = var.iam_overrides["runner_role_arn"] } : aws_iam_role.runner[0]
  • True branch: { arn = "..." } (1 attribute)
  • False branch: aws_iam_role.runner[0] (16 attributes including assume_role_policy, name, etc.)

Terraform requires both branches of a conditional to have consistent types. This causes a type error at plan time when override_runner_role = false (the default).

Fix

Move the conditional inside the object so both branches produce a string:

role = { arn = var.iam_overrides["override_runner_role"] ? var.iam_overrides["runner_role_arn"] : aws_iam_role.runner[0].arn }

This is consistent with how scale-up.tf (line 123) already handles the same conditional.

Testing

  • Verified terraform plan succeeds with override_runner_role = false (default)
  • The pool module's variable type is object({ arn = string }), so only the .arn attribute is needed

The conditional for the runner role in pool.tf returned inconsistent types:
the true branch produced an object with a single 'arn' attribute while the
false branch returned the full aws_iam_role resource (16 attributes).

Terraform requires both branches to have consistent types. Move the
conditional inside the object so both branches produce a string for the
'arn' key.

Fixes type error introduced in #4875.

Signed-off-by: Brend Smits <brend.smits@philips.com>
@Brend-Smits Brend-Smits requested a review from a team as a code owner June 11, 2026 12:15
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Brend-Smits added a commit to philips-forks/terraform-aws-github-runner that referenced this pull request Jun 11, 2026
The conditional for the runner role in pool.tf returned inconsistent types:
the true branch produced an object with a single 'arn' attribute while the
false branch returned the full aws_iam_role resource (16 attributes).

Terraform requires both branches to have consistent types. Move the
conditional inside the object so both branches produce a string for the
'arn' key.

Fixes type error introduced in github-aws-runners#4875.

Upstream-PR: github-aws-runners#5156
@Brend-Smits Brend-Smits merged commit 60de50f into main Jun 11, 2026
42 checks passed
@Brend-Smits Brend-Smits deleted the fix/pool-role-type-mismatch branch June 11, 2026 13:07
edersonbrilhante pushed a commit that referenced this pull request Jun 11, 2026
🤖 I have created a release *beep* *boop*
---


##
[7.7.1](v7.7.0...v7.7.1)
(2026-06-11)


### Bug Fixes

* **runners:** fix type mismatch in pool role conditional
([#5156](#5156))
([60de50f](60de50f))

---
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>
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.

2 participants