From 92814dfe9af9ea152bf35df359934742387abb10 Mon Sep 17 00:00:00 2001 From: Jean Schmidt <4520845+jeanschmidt@users.noreply.github.com> Date: Thu, 4 May 2023 12:36:22 +0200 Subject: [PATCH] Fixing networking issues (#4099) This issue will fix the issue https://github.com/pytorch/pytorch/issues/100545 --- terraform-aws-github-runner/main.tf | 6 ++---- terraform-aws-github-runner/modules/runners/scale-down.tf | 5 ++++- terraform-aws-github-runner/modules/runners/scale-up.tf | 7 +++++-- terraform-aws-github-runner/modules/runners/variables.tf | 6 ++++++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/terraform-aws-github-runner/main.tf b/terraform-aws-github-runner/main.tf index 7ade16adaa..01ce6b3ecc 100644 --- a/terraform-aws-github-runner/main.tf +++ b/terraform-aws-github-runner/main.tf @@ -122,10 +122,8 @@ module "runners" { lambda_timeout_scale_down = var.runners_scale_down_lambda_timeout lambda_subnet_ids = var.lambda_subnet_ids - lambda_security_group_ids = concat( - var.lambda_security_group_ids, - [module.runners_instances.security_groups_ids_vpcs[0]] - ) + lambda_security_group_ids = var.lambda_security_group_ids + runners_security_group_ids = module.runners_instances.security_groups_ids_vpcs github_app_key_base64 = module.runners_instances.github_app_key_base64 github_app_client_secret = module.runners_instances.github_app_client_secret role_runner_arn = module.runners_instances.role_runner_arn diff --git a/terraform-aws-github-runner/modules/runners/scale-down.tf b/terraform-aws-github-runner/modules/runners/scale-down.tf index 3345146f9b..d37279e990 100644 --- a/terraform-aws-github-runner/modules/runners/scale-down.tf +++ b/terraform-aws-github-runner/modules/runners/scale-down.tf @@ -49,7 +49,10 @@ resource "aws_lambda_function" "scale_down" { } vpc_config { - security_group_ids = var.lambda_security_group_ids + security_group_ids = concat( + var.lambda_security_group_ids, + [var.runners_security_group_ids[0]] + ) subnet_ids = var.lambda_subnet_ids } } diff --git a/terraform-aws-github-runner/modules/runners/scale-up.tf b/terraform-aws-github-runner/modules/runners/scale-up.tf index 87ea37b83d..b57f578bcb 100644 --- a/terraform-aws-github-runner/modules/runners/scale-up.tf +++ b/terraform-aws-github-runner/modules/runners/scale-up.tf @@ -71,7 +71,7 @@ resource "aws_lambda_function" "scale_up" { format( "%s|%s", vpc.vpc, - var.lambda_security_group_ids[local.vpc_id_to_idx[vpc.vpc]] + var.runners_security_group_ids[local.vpc_id_to_idx[vpc.vpc]] ) ], [ @@ -91,7 +91,10 @@ resource "aws_lambda_function" "scale_up" { } vpc_config { - security_group_ids = var.lambda_security_group_ids + security_group_ids = concat( + var.lambda_security_group_ids, + [var.runners_security_group_ids[0]] + ) subnet_ids = var.lambda_subnet_ids } } diff --git a/terraform-aws-github-runner/modules/runners/variables.tf b/terraform-aws-github-runner/modules/runners/variables.tf index 354511505c..b4081b83b3 100644 --- a/terraform-aws-github-runner/modules/runners/variables.tf +++ b/terraform-aws-github-runner/modules/runners/variables.tf @@ -178,6 +178,12 @@ variable "lambda_security_group_ids" { default = [] } +variable "runners_security_group_ids" { + description = "Security groups" + type = list(string) + default = [] +} + variable "secretsmanager_secrets_id" { description = "(optional) ID for secretsmanager secret to use for Github App credentials" type = string