terraform-aws-gitlab-runner icon indicating copy to clipboard operation
terraform-aws-gitlab-runner copied to clipboard

Terminate instances Lambda: Networking issue

Open andreas-mueller-bb opened this issue 5 months ago • 1 comments
trafficstars

Describe the bug

When the runners are placed in a public subnets the lambda function is too, as they share the same networking variables (vpc_id & subnet_id).

This leads to the lambda function not executing properly because it can't access the internet as the network interface of the lambda functions isn't associated with an elastic IP.

To Reproduce

Steps to reproduce the behavior:

  1. Deploy runner module in public subnet
  2. Trigger some kind of update to the ASG to the terminate instances lambda is triggered as well
  3. Observe the following error in its logs "[ERROR] ConnectTimeoutError: Connect timeout on endpoint URL: "https://ec2.eu-central-1.amazonaws.com/""

By allocating and associating an elastic IP manually to the lambda eni the problem was solved.

Expected behavior

It functioning properly.

Could be solved through

  • adding an option to pass an elastic IP to the runner and subsequently to the lambda module
  • adding an option to place the lambda function in a different subnet (i.e. a private one with NAT gateway or instance)

Additional context

If you guys have any feedback on something I may have misunderstood/misconfigured I'm more than happy to read it.

Best regards & keep up the good work!

andreas-mueller-bb avatar Jun 03 '25 13:06 andreas-mueller-bb