terraform-aws-gitlab-runner
terraform-aws-gitlab-runner copied to clipboard
Terminate instances Lambda: Networking issue
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:
- Deploy runner module in public subnet
- Trigger some kind of update to the ASG to the terminate instances lambda is triggered as well
- 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!