1. Packages
  2. AWS
  3. API Docs
  4. codecommit
  5. Repository
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.codecommit.Repository

Explore with Pulumi AI

Provides a CodeCommit Repository Resource.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const test = new aws.codecommit.Repository("test", {
    repositoryName: "MyTestRepository",
    description: "This is the Sample App Repository",
});
Copy
import pulumi
import pulumi_aws as aws

test = aws.codecommit.Repository("test",
    repository_name="MyTestRepository",
    description="This is the Sample App Repository")
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/codecommit"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := codecommit.NewRepository(ctx, "test", &codecommit.RepositoryArgs{
			RepositoryName: pulumi.String("MyTestRepository"),
			Description:    pulumi.String("This is the Sample App Repository"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var test = new Aws.CodeCommit.Repository("test", new()
    {
        RepositoryName = "MyTestRepository",
        Description = "This is the Sample App Repository",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.codecommit.Repository;
import com.pulumi.aws.codecommit.RepositoryArgs;
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 test = new Repository("test", RepositoryArgs.builder()
            .repositoryName("MyTestRepository")
            .description("This is the Sample App Repository")
            .build());

    }
}
Copy
resources:
  test:
    type: aws:codecommit:Repository
    properties:
      repositoryName: MyTestRepository
      description: This is the Sample App Repository
Copy

AWS KMS Customer Managed Keys (CMK)

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const testKey = new aws.kms.Key("test", {
    description: "test",
    deletionWindowInDays: 7,
});
const test = new aws.codecommit.Repository("test", {
    repositoryName: "MyTestRepository",
    description: "This is the Sample App Repository",
    kmsKeyId: testKey.arn,
});
Copy
import pulumi
import pulumi_aws as aws

test_key = aws.kms.Key("test",
    description="test",
    deletion_window_in_days=7)
test = aws.codecommit.Repository("test",
    repository_name="MyTestRepository",
    description="This is the Sample App Repository",
    kms_key_id=test_key.arn)
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/codecommit"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		testKey, err := kms.NewKey(ctx, "test", &kms.KeyArgs{
			Description:          pulumi.String("test"),
			DeletionWindowInDays: pulumi.Int(7),
		})
		if err != nil {
			return err
		}
		_, err = codecommit.NewRepository(ctx, "test", &codecommit.RepositoryArgs{
			RepositoryName: pulumi.String("MyTestRepository"),
			Description:    pulumi.String("This is the Sample App Repository"),
			KmsKeyId:       testKey.Arn,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var testKey = new Aws.Kms.Key("test", new()
    {
        Description = "test",
        DeletionWindowInDays = 7,
    });

    var test = new Aws.CodeCommit.Repository("test", new()
    {
        RepositoryName = "MyTestRepository",
        Description = "This is the Sample App Repository",
        KmsKeyId = testKey.Arn,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.kms.Key;
import com.pulumi.aws.kms.KeyArgs;
import com.pulumi.aws.codecommit.Repository;
import com.pulumi.aws.codecommit.RepositoryArgs;
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 testKey = new Key("testKey", KeyArgs.builder()
            .description("test")
            .deletionWindowInDays(7)
            .build());

        var test = new Repository("test", RepositoryArgs.builder()
            .repositoryName("MyTestRepository")
            .description("This is the Sample App Repository")
            .kmsKeyId(testKey.arn())
            .build());

    }
}
Copy
resources:
  test:
    type: aws:codecommit:Repository
    properties:
      repositoryName: MyTestRepository
      description: This is the Sample App Repository
      kmsKeyId: ${testKey.arn}
  testKey:
    type: aws:kms:Key
    name: test
    properties:
      description: test
      deletionWindowInDays: 7
Copy

Create Repository Resource

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

Constructor syntax

new Repository(name: string, args: RepositoryArgs, opts?: CustomResourceOptions);
@overload
def Repository(resource_name: str,
               args: RepositoryArgs,
               opts: Optional[ResourceOptions] = None)

@overload
def Repository(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               repository_name: Optional[str] = None,
               default_branch: Optional[str] = None,
               description: Optional[str] = None,
               kms_key_id: Optional[str] = None,
               tags: Optional[Mapping[str, str]] = None)
func NewRepository(ctx *Context, name string, args RepositoryArgs, opts ...ResourceOption) (*Repository, error)
public Repository(string name, RepositoryArgs args, CustomResourceOptions? opts = null)
public Repository(String name, RepositoryArgs args)
public Repository(String name, RepositoryArgs args, CustomResourceOptions options)
type: aws:codecommit:Repository
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RepositoryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. RepositoryArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. RepositoryArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RepositoryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RepositoryArgs
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 awsRepositoryResource = new Aws.CodeCommit.Repository("awsRepositoryResource", new()
{
    RepositoryName = "string",
    DefaultBranch = "string",
    Description = "string",
    KmsKeyId = "string",
    Tags = 
    {
        { "string", "string" },
    },
});
Copy
example, err := codecommit.NewRepository(ctx, "awsRepositoryResource", &codecommit.RepositoryArgs{
	RepositoryName: pulumi.String("string"),
	DefaultBranch:  pulumi.String("string"),
	Description:    pulumi.String("string"),
	KmsKeyId:       pulumi.String("string"),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
Copy
var awsRepositoryResource = new Repository("awsRepositoryResource", RepositoryArgs.builder()
    .repositoryName("string")
    .defaultBranch("string")
    .description("string")
    .kmsKeyId("string")
    .tags(Map.of("string", "string"))
    .build());
Copy
aws_repository_resource = aws.codecommit.Repository("awsRepositoryResource",
    repository_name="string",
    default_branch="string",
    description="string",
    kms_key_id="string",
    tags={
        "string": "string",
    })
Copy
const awsRepositoryResource = new aws.codecommit.Repository("awsRepositoryResource", {
    repositoryName: "string",
    defaultBranch: "string",
    description: "string",
    kmsKeyId: "string",
    tags: {
        string: "string",
    },
});
Copy
type: aws:codecommit:Repository
properties:
    defaultBranch: string
    description: string
    kmsKeyId: string
    repositoryName: string
    tags:
        string: string
Copy

Repository 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 Repository resource accepts the following input properties:

RepositoryName This property is required. string
The name for the repository. This needs to be less than 100 characters.
DefaultBranch string
The default branch of the repository. The branch specified here needs to exist.
Description string
The description of the repository. This needs to be less than 1000 characters
KmsKeyId string
The ARN of the encryption key. If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.
Tags Dictionary<string, string>
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
RepositoryName This property is required. string
The name for the repository. This needs to be less than 100 characters.
DefaultBranch string
The default branch of the repository. The branch specified here needs to exist.
Description string
The description of the repository. This needs to be less than 1000 characters
KmsKeyId string
The ARN of the encryption key. If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.
Tags map[string]string
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
repositoryName This property is required. String
The name for the repository. This needs to be less than 100 characters.
defaultBranch String
The default branch of the repository. The branch specified here needs to exist.
description String
The description of the repository. This needs to be less than 1000 characters
kmsKeyId String
The ARN of the encryption key. If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.
tags Map<String,String>
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
repositoryName This property is required. string
The name for the repository. This needs to be less than 100 characters.
defaultBranch string
The default branch of the repository. The branch specified here needs to exist.
description string
The description of the repository. This needs to be less than 1000 characters
kmsKeyId string
The ARN of the encryption key. If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.
tags {[key: string]: string}
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
repository_name This property is required. str
The name for the repository. This needs to be less than 100 characters.
default_branch str
The default branch of the repository. The branch specified here needs to exist.
description str
The description of the repository. This needs to be less than 1000 characters
kms_key_id str
The ARN of the encryption key. If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.
tags Mapping[str, str]
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
repositoryName This property is required. String
The name for the repository. This needs to be less than 100 characters.
defaultBranch String
The default branch of the repository. The branch specified here needs to exist.
description String
The description of the repository. This needs to be less than 1000 characters
kmsKeyId String
The ARN of the encryption key. If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.
tags Map<String>
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Outputs

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

Arn string
The ARN of the repository
CloneUrlHttp string
The URL to use for cloning the repository over HTTPS.
CloneUrlSsh string
The URL to use for cloning the repository over SSH.
Id string
The provider-assigned unique ID for this managed resource.
RepositoryId string
The ID of the repository
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
The ARN of the repository
CloneUrlHttp string
The URL to use for cloning the repository over HTTPS.
CloneUrlSsh string
The URL to use for cloning the repository over SSH.
Id string
The provider-assigned unique ID for this managed resource.
RepositoryId string
The ID of the repository
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
The ARN of the repository
cloneUrlHttp String
The URL to use for cloning the repository over HTTPS.
cloneUrlSsh String
The URL to use for cloning the repository over SSH.
id String
The provider-assigned unique ID for this managed resource.
repositoryId String
The ID of the repository
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
The ARN of the repository
cloneUrlHttp string
The URL to use for cloning the repository over HTTPS.
cloneUrlSsh string
The URL to use for cloning the repository over SSH.
id string
The provider-assigned unique ID for this managed resource.
repositoryId string
The ID of the repository
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
The ARN of the repository
clone_url_http str
The URL to use for cloning the repository over HTTPS.
clone_url_ssh str
The URL to use for cloning the repository over SSH.
id str
The provider-assigned unique ID for this managed resource.
repository_id str
The ID of the repository
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
The ARN of the repository
cloneUrlHttp String
The URL to use for cloning the repository over HTTPS.
cloneUrlSsh String
The URL to use for cloning the repository over SSH.
id String
The provider-assigned unique ID for this managed resource.
repositoryId String
The ID of the repository
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Look up Existing Repository Resource

Get an existing Repository 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?: RepositoryState, opts?: CustomResourceOptions): Repository
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        clone_url_http: Optional[str] = None,
        clone_url_ssh: Optional[str] = None,
        default_branch: Optional[str] = None,
        description: Optional[str] = None,
        kms_key_id: Optional[str] = None,
        repository_id: Optional[str] = None,
        repository_name: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None) -> Repository
func GetRepository(ctx *Context, name string, id IDInput, state *RepositoryState, opts ...ResourceOption) (*Repository, error)
public static Repository Get(string name, Input<string> id, RepositoryState? state, CustomResourceOptions? opts = null)
public static Repository get(String name, Output<String> id, RepositoryState state, CustomResourceOptions options)
resources:  _:    type: aws:codecommit:Repository    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 the repository
CloneUrlHttp string
The URL to use for cloning the repository over HTTPS.
CloneUrlSsh string
The URL to use for cloning the repository over SSH.
DefaultBranch string
The default branch of the repository. The branch specified here needs to exist.
Description string
The description of the repository. This needs to be less than 1000 characters
KmsKeyId string
The ARN of the encryption key. If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.
RepositoryId string
The ID of the repository
RepositoryName string
The name for the repository. This needs to be less than 100 characters.
Tags Dictionary<string, string>
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
The ARN of the repository
CloneUrlHttp string
The URL to use for cloning the repository over HTTPS.
CloneUrlSsh string
The URL to use for cloning the repository over SSH.
DefaultBranch string
The default branch of the repository. The branch specified here needs to exist.
Description string
The description of the repository. This needs to be less than 1000 characters
KmsKeyId string
The ARN of the encryption key. If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.
RepositoryId string
The ID of the repository
RepositoryName string
The name for the repository. This needs to be less than 100 characters.
Tags map[string]string
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
The ARN of the repository
cloneUrlHttp String
The URL to use for cloning the repository over HTTPS.
cloneUrlSsh String
The URL to use for cloning the repository over SSH.
defaultBranch String
The default branch of the repository. The branch specified here needs to exist.
description String
The description of the repository. This needs to be less than 1000 characters
kmsKeyId String
The ARN of the encryption key. If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.
repositoryId String
The ID of the repository
repositoryName String
The name for the repository. This needs to be less than 100 characters.
tags Map<String,String>
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
The ARN of the repository
cloneUrlHttp string
The URL to use for cloning the repository over HTTPS.
cloneUrlSsh string
The URL to use for cloning the repository over SSH.
defaultBranch string
The default branch of the repository. The branch specified here needs to exist.
description string
The description of the repository. This needs to be less than 1000 characters
kmsKeyId string
The ARN of the encryption key. If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.
repositoryId string
The ID of the repository
repositoryName string
The name for the repository. This needs to be less than 100 characters.
tags {[key: string]: string}
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
The ARN of the repository
clone_url_http str
The URL to use for cloning the repository over HTTPS.
clone_url_ssh str
The URL to use for cloning the repository over SSH.
default_branch str
The default branch of the repository. The branch specified here needs to exist.
description str
The description of the repository. This needs to be less than 1000 characters
kms_key_id str
The ARN of the encryption key. If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.
repository_id str
The ID of the repository
repository_name str
The name for the repository. This needs to be less than 100 characters.
tags Mapping[str, str]
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
The ARN of the repository
cloneUrlHttp String
The URL to use for cloning the repository over HTTPS.
cloneUrlSsh String
The URL to use for cloning the repository over SSH.
defaultBranch String
The default branch of the repository. The branch specified here needs to exist.
description String
The description of the repository. This needs to be less than 1000 characters
kmsKeyId String
The ARN of the encryption key. If no key is specified, the default aws/codecommit Amazon Web Services managed key is used.
repositoryId String
The ID of the repository
repositoryName String
The name for the repository. This needs to be less than 100 characters.
tags Map<String>
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Import

Using pulumi import, import CodeCommit repository using repository name. For example:

$ pulumi import aws:codecommit/repository:Repository imported ExistingRepo
Copy

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.