Skip to content

fix(runners): set security groups on the interfaces when network_interfaces is set - #5561

Merged
Brend-Smits merged 3 commits into
github-aws-runners:mainfrom
atsikham:fix/network-interfaces-security-groups
Nov 19, 2026
Merged

Brend-Smits merged 3 commits into
github-aws-runners:mainfrom
atsikham:fix/network-interfaces-security-groups

Conversation

@atsikham

@atsikham atsikham commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #5560

Summary

When network_interfaces is set and associate_public_ipv4_address is false, the runner launch template set both vpc_security_group_ids and network interfaces. EC2 rejects this with InvalidParameterCombination, so CreateFleet launched no instance and the job stayed queued.

Changes

Same change in modules/runners/main.tf and modules/compute-providers/aws/ec2/runner-instances.tf:

  • vpc_security_group_ids is set only when the launch template has no network interfaces.
  • An interface without security_groups gets the managed security group and the additional security groups. An interface that attaches an existing network_interface_id gets none, because EC2 does not accept security groups for it in the template.
  • The managed and additional security groups are built once in a local and reused.
  • The network_interfaces descriptions (root, modules/runners, modules/multi-runner, runner-config, EC2 provider) describe this. The v1 field docs of modules/multi-runner now include network_interfaces.

No change without network_interfaces: the security groups stay on the instance, and with associate_public_ipv4_address they stay on its interface.

Test plan

  • modules/runners/tests/launch-template.tftest.hcl and modules/compute-providers/aws/ec2/tests/provider.tftest.hcl:
    • with interfaces: no instance-level security groups; an interface without security_groups gets the runner security groups, one with its own keeps them, one with network_interface_id gets none
    • without interfaces: the security groups stay on the instance
  • The new interface test fails without the change in both modules.
  • Full suites: modules/runners (9), EC2 provider (12), modules/multi-runner (21), modules/runner-config (17). terraform fmt and terraform validate.
  • READMEs regenerated with the terraform-docs image used by CI.

…rfaces is set

With network_interfaces set, the launch template also kept the instance-level
security groups, which EC2 rejects with InvalidParameterCombination. The
security groups are now set on the instance only when the template has no
network interfaces. An interface without security_groups gets the managed and
additional security groups, unless it attaches an existing ENI.

Fixes github-aws-runners#5560
@atsikham
atsikham requested review from a team as code owners October 27, 2026 21:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the runner security-group placement changes.

No open issues 🎉

What changed in this PR

Fixes #5560 by moving runner security groups onto network interfaces when interfaces are configured, avoiding the EC2 parameter conflict that prevented runners from launching. Applies the same behavior to the runners module and the EC2 compute provider.

Changes:

  • Reuses a shared security-group local and omits instance-level groups when network interfaces are present.
  • Adds regression tests for interface defaults, explicit groups, existing interfaces, and configurations without interfaces.
  • Updates variable descriptions and generated READMEs to explain security-group placement.
File Description
variables.tf Documents root-level interface security-group behavior.
README.md Updates generated root input documentation.
modules/​runners/​variables.tf Documents runner interface defaults and exceptions.
modules/​runners/​tests/​launch-template.tftest.hcl Tests security-group placement in runner launch templates.
modules/​runners/​README.md Updates generated runner input documentation.
modules/​runners/​main.tf Fixes security-group placement in runner launch templates.
modules/​runner-config/​variables.compute-provider.tf Documents EC2 interface security-group behavior.
modules/​runner-config/​README.md Updates generated compute-provider configuration documentation.
modules/​multi-runner/​variables.tf Adds v1 network-interface field documentation.
modules/​multi-runner/​README.md Includes the new v1 field description.
modules/​compute-providers/​aws/​ec2/​variables.tf Documents provider interface defaults and exceptions.
modules/​compute-providers/​aws/​ec2/​tests/​provider.tftest.hcl Tests security-group placement in provider launch templates.
modules/​compute-providers/​aws/​ec2/​runner-instances.tf Applies the security-group placement fix to the EC2 provider.
modules/​compute-providers/​aws/​ec2/​README.md Updates generated EC2 provider input documentation.

Review effort: Balanced

guicaulada
guicaulada previously approved these changes Nov 17, 2026
…s-security-groups

# Conflicts:
#	modules/multi-runner/README.md
#	modules/runners/tests/launch-template.tftest.hcl
@atsikham

atsikham commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

@guicaulada Thanks for review! There are no merge conflicts now, could you re-check and approve again?

@Brend-Smits
Brend-Smits enabled auto-merge (squash) November 19, 2026 19:51
@Brend-Smits
Brend-Smits merged commit 1ef888c into github-aws-runners:main Nov 19, 2026
55 checks passed
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.

fix(runners): launch template keeps instance-level security groups when network_interfaces is set

4 participants