1. Packages
  2. AWS
  3. API Docs
  4. codebuild
  5. SourceCredential
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.codebuild.SourceCredential

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Provides a CodeBuild Source Credentials Resource.

    NOTE: Codebuild only allows a single credential per given server type in a given region. Therefore, when you define aws.codebuild.SourceCredential, aws.codebuild.Project resource defined in the same module will use it.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.codebuild.SourceCredential("example", {
        authType: "PERSONAL_ACCESS_TOKEN",
        serverType: "GITHUB",
        token: "example",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.codebuild.SourceCredential("example",
        auth_type="PERSONAL_ACCESS_TOKEN",
        server_type="GITHUB",
        token="example")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/codebuild"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := codebuild.NewSourceCredential(ctx, "example", &codebuild.SourceCredentialArgs{
    			AuthType:   pulumi.String("PERSONAL_ACCESS_TOKEN"),
    			ServerType: pulumi.String("GITHUB"),
    			Token:      pulumi.String("example"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.CodeBuild.SourceCredential("example", new()
        {
            AuthType = "PERSONAL_ACCESS_TOKEN",
            ServerType = "GITHUB",
            Token = "example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.codebuild.SourceCredential;
    import com.pulumi.aws.codebuild.SourceCredentialArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new SourceCredential("example", SourceCredentialArgs.builder()
                .authType("PERSONAL_ACCESS_TOKEN")
                .serverType("GITHUB")
                .token("example")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:codebuild:SourceCredential
        properties:
          authType: PERSONAL_ACCESS_TOKEN
          serverType: GITHUB
          token: example
    

    Bitbucket Server Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.codebuild.SourceCredential("example", {
        authType: "BASIC_AUTH",
        serverType: "BITBUCKET",
        token: "example",
        userName: "test-user",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.codebuild.SourceCredential("example",
        auth_type="BASIC_AUTH",
        server_type="BITBUCKET",
        token="example",
        user_name="test-user")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/codebuild"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := codebuild.NewSourceCredential(ctx, "example", &codebuild.SourceCredentialArgs{
    			AuthType:   pulumi.String("BASIC_AUTH"),
    			ServerType: pulumi.String("BITBUCKET"),
    			Token:      pulumi.String("example"),
    			UserName:   pulumi.String("test-user"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.CodeBuild.SourceCredential("example", new()
        {
            AuthType = "BASIC_AUTH",
            ServerType = "BITBUCKET",
            Token = "example",
            UserName = "test-user",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.codebuild.SourceCredential;
    import com.pulumi.aws.codebuild.SourceCredentialArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new SourceCredential("example", SourceCredentialArgs.builder()
                .authType("BASIC_AUTH")
                .serverType("BITBUCKET")
                .token("example")
                .userName("test-user")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:codebuild:SourceCredential
        properties:
          authType: BASIC_AUTH
          serverType: BITBUCKET
          token: example
          userName: test-user
    

    Create SourceCredential Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new SourceCredential(name: string, args: SourceCredentialArgs, opts?: CustomResourceOptions);
    @overload
    def SourceCredential(resource_name: str,
                         args: SourceCredentialArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def SourceCredential(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         auth_type: Optional[str] = None,
                         server_type: Optional[str] = None,
                         token: Optional[str] = None,
                         user_name: Optional[str] = None)
    func NewSourceCredential(ctx *Context, name string, args SourceCredentialArgs, opts ...ResourceOption) (*SourceCredential, error)
    public SourceCredential(string name, SourceCredentialArgs args, CustomResourceOptions? opts = null)
    public SourceCredential(String name, SourceCredentialArgs args)
    public SourceCredential(String name, SourceCredentialArgs args, CustomResourceOptions options)
    
    type: aws:codebuild:SourceCredential
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args SourceCredentialArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args SourceCredentialArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args SourceCredentialArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SourceCredentialArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SourceCredentialArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var sourceCredentialResource = new Aws.CodeBuild.SourceCredential("sourceCredentialResource", new()
    {
        AuthType = "string",
        ServerType = "string",
        Token = "string",
        UserName = "string",
    });
    
    example, err := codebuild.NewSourceCredential(ctx, "sourceCredentialResource", &codebuild.SourceCredentialArgs{
    	AuthType:   pulumi.String("string"),
    	ServerType: pulumi.String("string"),
    	Token:      pulumi.String("string"),
    	UserName:   pulumi.String("string"),
    })
    
    var sourceCredentialResource = new SourceCredential("sourceCredentialResource", SourceCredentialArgs.builder()
        .authType("string")
        .serverType("string")
        .token("string")
        .userName("string")
        .build());
    
    source_credential_resource = aws.codebuild.SourceCredential("sourceCredentialResource",
        auth_type="string",
        server_type="string",
        token="string",
        user_name="string")
    
    const sourceCredentialResource = new aws.codebuild.SourceCredential("sourceCredentialResource", {
        authType: "string",
        serverType: "string",
        token: "string",
        userName: "string",
    });
    
    type: aws:codebuild:SourceCredential
    properties:
        authType: string
        serverType: string
        token: string
        userName: string
    

    SourceCredential Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The SourceCredential resource accepts the following input properties:

    AuthType string
    The type of authentication used to connect to a GitHub, GitHub Enterprise, or Bitbucket repository. An OAUTH connection is not supported by the API.
    ServerType string
    The source provider used for this project.
    Token string
    For GitHub or GitHub Enterprise, this is the personal access token. For Bitbucket, this is the app password.
    UserName string
    The Bitbucket username when the authType is BASIC_AUTH. This parameter is not valid for other types of source providers or connections.
    AuthType string
    The type of authentication used to connect to a GitHub, GitHub Enterprise, or Bitbucket repository. An OAUTH connection is not supported by the API.
    ServerType string
    The source provider used for this project.
    Token string
    For GitHub or GitHub Enterprise, this is the personal access token. For Bitbucket, this is the app password.
    UserName string
    The Bitbucket username when the authType is BASIC_AUTH. This parameter is not valid for other types of source providers or connections.
    authType String
    The type of authentication used to connect to a GitHub, GitHub Enterprise, or Bitbucket repository. An OAUTH connection is not supported by the API.
    serverType String
    The source provider used for this project.
    token String
    For GitHub or GitHub Enterprise, this is the personal access token. For Bitbucket, this is the app password.
    userName String
    The Bitbucket username when the authType is BASIC_AUTH. This parameter is not valid for other types of source providers or connections.
    authType string
    The type of authentication used to connect to a GitHub, GitHub Enterprise, or Bitbucket repository. An OAUTH connection is not supported by the API.
    serverType string
    The source provider used for this project.
    token string
    For GitHub or GitHub Enterprise, this is the personal access token. For Bitbucket, this is the app password.
    userName string
    The Bitbucket username when the authType is BASIC_AUTH. This parameter is not valid for other types of source providers or connections.
    auth_type str
    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 str
    The source provider used for this project.
    token str
    For GitHub or GitHub Enterprise, this is the personal access token. For Bitbucket, this is the app password.
    user_name str
    The Bitbucket username when the authType is BASIC_AUTH. This parameter is not valid for other types of source providers or connections.
    authType String
    The type of authentication used to connect to a GitHub, GitHub Enterprise, or Bitbucket repository. An OAUTH connection is not supported by the API.
    serverType String
    The source provider used for this project.
    token String
    For GitHub or GitHub Enterprise, this is the personal access token. For Bitbucket, this is the app password.
    userName String
    The Bitbucket username when the authType is BASIC_AUTH. This parameter is not valid for other types of source providers or connections.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the SourceCredential resource produces the following output properties:

    Arn string
    The ARN of Source Credential.
    Id string
    The provider-assigned unique ID for this managed resource.
    Arn string
    The ARN of Source Credential.
    Id string
    The provider-assigned unique ID for this managed resource.
    arn String
    The ARN of Source Credential.
    id String
    The provider-assigned unique ID for this managed resource.
    arn string
    The ARN of Source Credential.
    id string
    The provider-assigned unique ID for this managed resource.
    arn str
    The ARN of Source Credential.
    id str
    The provider-assigned unique ID for this managed resource.
    arn String
    The ARN of Source Credential.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing SourceCredential Resource

    Get an existing SourceCredential resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: SourceCredentialState, opts?: CustomResourceOptions): SourceCredential
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arn: Optional[str] = None,
            auth_type: Optional[str] = None,
            server_type: Optional[str] = None,
            token: Optional[str] = None,
            user_name: Optional[str] = None) -> SourceCredential
    func GetSourceCredential(ctx *Context, name string, id IDInput, state *SourceCredentialState, opts ...ResourceOption) (*SourceCredential, error)
    public static SourceCredential Get(string name, Input<string> id, SourceCredentialState? state, CustomResourceOptions? opts = null)
    public static SourceCredential get(String name, Output<String> id, SourceCredentialState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Arn string
    The ARN of Source Credential.
    AuthType string
    The type of authentication used to connect to a GitHub, GitHub Enterprise, or Bitbucket repository. An OAUTH connection is not supported by the API.
    ServerType string
    The source provider used for this project.
    Token string
    For GitHub or GitHub Enterprise, this is the personal access token. For Bitbucket, this is the app password.
    UserName string
    The Bitbucket username when the authType is BASIC_AUTH. This parameter is not valid for other types of source providers or connections.
    Arn string
    The ARN of Source Credential.
    AuthType string
    The type of authentication used to connect to a GitHub, GitHub Enterprise, or Bitbucket repository. An OAUTH connection is not supported by the API.
    ServerType string
    The source provider used for this project.
    Token string
    For GitHub or GitHub Enterprise, this is the personal access token. For Bitbucket, this is the app password.
    UserName string
    The Bitbucket username when the authType is BASIC_AUTH. This parameter is not valid for other types of source providers or connections.
    arn String
    The ARN of Source Credential.
    authType String
    The type of authentication used to connect to a GitHub, GitHub Enterprise, or Bitbucket repository. An OAUTH connection is not supported by the API.
    serverType String
    The source provider used for this project.
    token String
    For GitHub or GitHub Enterprise, this is the personal access token. For Bitbucket, this is the app password.
    userName String
    The Bitbucket username when the authType is BASIC_AUTH. This parameter is not valid for other types of source providers or connections.
    arn string
    The ARN of Source Credential.
    authType string
    The type of authentication used to connect to a GitHub, GitHub Enterprise, or Bitbucket repository. An OAUTH connection is not supported by the API.
    serverType string
    The source provider used for this project.
    token string
    For GitHub or GitHub Enterprise, this is the personal access token. For Bitbucket, this is the app password.
    userName string
    The Bitbucket username when the authType is BASIC_AUTH. This parameter is not valid for other types of source providers or connections.
    arn str
    The ARN of Source Credential.
    auth_type str
    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 str
    The source provider used for this project.
    token str
    For GitHub or GitHub Enterprise, this is the personal access token. For Bitbucket, this is the app password.
    user_name str
    The Bitbucket username when the authType is BASIC_AUTH. This parameter is not valid for other types of source providers or connections.
    arn String
    The ARN of Source Credential.
    authType String
    The type of authentication used to connect to a GitHub, GitHub Enterprise, or Bitbucket repository. An OAUTH connection is not supported by the API.
    serverType String
    The source provider used for this project.
    token String
    For GitHub or GitHub Enterprise, this is the personal access token. For Bitbucket, this is the app password.
    userName String
    The Bitbucket username when the authType is BASIC_AUTH. This parameter is not valid for other types of source providers or connections.

    Import

    Using pulumi import, import CodeBuild Source Credential using the CodeBuild Source Credential arn. For example:

    $ pulumi import aws:codebuild/sourceCredential:SourceCredential example arn:aws:codebuild:us-west-2:123456789:token:github
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi