AWS codebuild github Integration Issue

Hi All,

I am trying to create an AWS codebuild project using terraform using GITHUB as a source

resource “aws_codebuild_project” “training-service” {

name = “${var.github_repository}”

build_timeout = “5”

service_role = “${aws_iam_role.codebuild.arn}”

badge_enabled = “${var.codebuild_badge_enabled}”

source {

type      = "GITHUB"

location  = "${data.template_file.codebuild_source_location.rendered}"

buildspec = "${var.codebuild_buildspec}"

auth {

  type     = "OAUTH"

  resource = "${var.github_oauth_token}"



environment {

compute_type         = "${var.codebuild_compute_type}"

type                 = "LINUX_CONTAINER"

image                = "${var.codebuild_image}"

privileged_mode      = "${var.codebuild_privileged_mode}"


artifacts {

type           = "S3"

location       = "${}"

name           = "${var.github_repository}"

namespace_type = "BUILD_ID"

packaging      = "ZIP"



I verified from terraform docs also and this is the correct way of doing it.

variable “github_oauth_token” {

description = “GitHub OAuth token for repository access”



I am getting below exception. can anyone help?

Error: Error creating CodeBuild project: InvalidInputException: No Access token found, please visit AWS CodeBuild console to connect to GitHub

on line 103, in resource “aws_codebuild_project” “training-service”:
103: resource “aws_codebuild_project” “training-service” {

For the future developers facing this same issue, I found this note from aws_codebuild_webhook -resource documentation:


The AWS account that Terraform uses to create this resource must have authorized CodeBuild to access Bitbucket/GitHub’s OAuth API in each applicable region. This is a manual step that must be done before creating webhooks with this resource. If OAuth is not configured, AWS will return an error similar to ResourceNotFoundException: Could not find access token for server type github . More information can be found in the CodeBuild User Guide for Bitbucket and GitHub.