使用 philips labs terraform aws 自托管模块时不会创建 ec2 实例

问题描述 投票:0回答:1

我一直在尝试测试和实施自托管运行器,但问题是即使在所有内容都连接后实例也会打开。我已经遵循了 github 应用程序的每一步和所有内容,但实例仍然没有出现。 Cloudwatch 注册了该请求,但由于某种原因,创建实例的请求不起作用。我已附上 main.tf 文件,请有人帮助解决这个问题。

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "4.44.0"
    }
  }
}

provider "aws" {
  region     = var.aws_region
  access_key = "Akey"
  secret_key = "skey"
}

data "aws_caller_identity" "current" {}

resource "random_id" "random" {
  byte_length = 20
}
resource "aws_iam_service_linked_role" "spot" {
  aws_service_name = "spot.amazonaws.com"
}
module "github-runner" {
  create_service_linked_role_spot = true
  source  = "philips-labs/github-runner/aws"
  version = "2.0.0-next.1"

  aws_region = var.aws_region
  vpc_id     = module.vpc.vpc_id
  subnet_ids = module.vpc.private_subnets

  prefix = var.prefix

  github_app = {
    key_base64     = "key"
    id = "id"
    webhook_secret = random_id.random.hex
  }

  webhook_lambda_zip                = "lambdas-download/webhook.zip"
  runner_binaries_syncer_lambda_zip = "lambdas-download/runner-binaries-syncer.zip"
  runners_lambda_zip                = "lambdas-download/runners.zip"
  enable_organization_runners = true
  runner_extra_labels         = "default,example"


  # enable access to the runners via SSM
  enable_ssm_on_runners = true

  instance_types = ["m5.large", "c5.large"]
  # Uncomment to enable ephemeral runners
  runner_run_as = "ubuntu"
  enable_ephemeral_runners = false
  # enabled_userdata         = true
  delay_webhook_event      = 0
  runners_maximum_count = 20

  idle_config = [{
    cron      = "* * o-23 * * *"
    timeZone  = "Europe/Amsterdam"
    idleCount = 3
  }]


  # fifo_build_queue = true
  enable_job_queued_check = true
  # override scaling down
  scale_down_schedule_expression = "cron(* * * * ? *)"
}

我尝试过使用临时和 isle 配置来启用和禁用 fifo 队列以及大多数其他切换,但似乎没有任何效果。

amazon-web-services github amazon-ec2 terraform github-actions
1个回答
0
投票

如果您想要更简单的设置,您还可以使用 https://sprinters.sh,它会自动在 EC2 上为每个作业启动快速启动的临时运行程序。

配置非常简单

jobs:
  build:
    runs-on: sprinters:aws/t3.large/ubuntu-latest
© www.soinside.com 2019 - 2024. All rights reserved.