terraform-aws-gitlab-runner
terraform-aws-gitlab-runner copied to clipboard
Extract role and instance_profile into separate module
The way to have a multiple spot instance types is to use multiple instances of the runner #77 Same if you want multiple availability zones #76
You now have two roles, runners and runners2 (from https://github.com/npalm/terraform-aws-gitlab-runner/blob/develop/examples/runner-public/main.tf).
The problem becomes if you want to give your runners access to ECR for example, you have to give access to multiple Principals. If you extract the role into a separate module and reuse it, then you only have to add a single principal to your other resources the module is accessing.
They are related in that they are the same runner kind just deployed in another zone or with another instance type to avoid capacity issues.
I also discovered this after changing to 3 AZs. Wouldn't it be easier to create the role/profile yourself and pass it to the module? Then the module can add the policies needed. @npalm What do you think?
Or even better: Add multi AZ support to the module and handle all the stuff internally.