0

我使用 github、terraform 和 AWS。使用 terraform,我需要创建 codebuild、webhook 等。当我执行“terraform apply”时出现此错误:

Error: error creating CodeBuild Webhook: ResourceNotFoundException: Could not find access token for server type github

我在 terraform 中的 aws_codebuild_webhook 是这样的:

resource "aws_codebuild_webhook" "build_hook" {
  project_name = aws_codebuild_project.plan_build_proj.name
  build_type   = "BUILD"
  filter_group {
    filter {
      type    = "EVENT"
      pattern = "PULL_REQUEST_CREATED,PULL_REQUEST_UPDATED"
    }
  }
}

我的 aws_codebuild_project 是这样的:

resource "aws_codebuild_project" "plan_build_proj" {
  badge_enabled  = false
  build_timeout  = 60
  name           = "${var.plan_build_name}_${var.stage}"
  queued_timeout = 480
  service_role   = aws_iam_role.build_role.arn
  tags = {
    Environment = var.stage
  }

  artifacts {
    type = "NO_ARTIFACTS"
  }

  environment {
    compute_type                = "BUILD_GENERAL1_SMALL"
    image                       = "aws/codebuild/amazonlinux2-x86_64-standard:2.0"
    image_pull_credentials_type = "CODEBUILD"
    privileged_mode             = false
    type                        = "LINUX_CONTAINER"

  }

  source {
    buildspec           = data.template_file.buildspec_plan.rendered
    location            = "${var.repository_name_fullpath}"
    git_clone_depth     = 0
    insecure_ssl        = false
    report_build_status = false
    type                = "GITHUB"
  }
}
4

0 回答 0