Provides a CodeBuild Source Credentials Resource.
resource "aws_codebuild_source_credential" "example" {
auth_type = "PERSONAL_ACCESS_TOKEN"
server_type = "GITHUB"
token = "example"
}
resource "aws_codebuild_source_credential" "example" {
auth_type = "BASIC_AUTH"
server_type = "BITBUCKET"
token = "example"
user_name = "test-user"
}
This resource supports the following arguments:
auth_type
- (Required) The type of authentication used to connect to a GitHub, GitHub Enterprise, or Bitbucket repository. An OAUTH connection is not supported by the API.server_type
- (Required) The source provider used for this project.token
- (Required) For GitHub
or GitHub Enterprise
, this is the personal access token. For Bitbucket
, this is the app password.user_name
- (Optional) The Bitbucket username when the authType is BASIC_AUTH
. This parameter is not valid for other types of source providers or connections.This resource exports the following attributes in addition to the arguments above:
id
- The ARN of Source Credential.arn
- The ARN of Source Credential.In Terraform v1.5.0 and later, use an import
block to import CodeBuild Source Credential using the CodeBuild Source Credential arn. For example:
import {
to = aws_codebuild_source_credential.example
id = "arn:aws:codebuild:us-west-2:123456789:token:github"
}
Using terraform import
, import CodeBuild Source Credential using the CodeBuild Source Credential arn. For example:
% terraform import aws_codebuild_source_credential.example arn:aws:codebuild:us-west-2:123456789:token:github