Skip to content

Commit

Permalink
Enable Lambda token refresh to prevent runner recovery deadlocks
Browse files Browse the repository at this point in the history
- Set enable_lambda_token_refresh = true in default.auto.tfvars
- Add ec2:CreateNetworkInterface/DescribeNetworkInterfaces/DeleteNetworkInterface
  to Lambda IAM policy (required for VPC-attached Lambda functions)

Lambda refreshes GitHub Actions registration token every 30 minutes.
Prevents deadlock when all runners die simultaneously and token expires
before ECS can restart tasks.
  • Loading branch information
Your Name committed Mar 19, 2026
1 parent 0dd3f22 commit f7094b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions default.auto.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ desired_count = 1

# Monitoring Configuration
alert_email = "david.j.arnold.jr@census.gov"

# Enable Lambda token refresh to prevent runner recovery deadlocks
# Runs every 30 minutes to keep Secrets Manager token fresh (tokens expire in 1 hour)
enable_lambda_token_refresh = true
10 changes: 10 additions & 0 deletions lambda_token_refresh.tf
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@ resource "aws_iam_role_policy" "lambda_refresh_policy" {
"logs:PutLogEvents"
]
Resource = "arn:${data.aws_partition.current.partition}:logs:*:*:log-group:/aws/lambda/${local.lambda_function_name}:*"
},
{
# Required for Lambda functions deployed into a VPC
Effect = "Allow"
Action = [
"ec2:CreateNetworkInterface",
"ec2:DescribeNetworkInterfaces",
"ec2:DeleteNetworkInterface"
]
Resource = "*"
}
]
})
Expand Down

0 comments on commit f7094b5

Please sign in to comment.