aws logo
AWS Classic v5.41.0, May 15 23

aws.sagemaker.CodeRepository

Explore with Pulumi AI

Provides a SageMaker Code Repository resource.

Example Usage

Basic usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.Sagemaker.CodeRepository("example", new()
    {
        CodeRepositoryName = "example",
        GitConfig = new Aws.Sagemaker.Inputs.CodeRepositoryGitConfigArgs
        {
            RepositoryUrl = "https://github.com/github/docs.git",
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/sagemaker"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sagemaker.NewCodeRepository(ctx, "example", &sagemaker.CodeRepositoryArgs{
			CodeRepositoryName: pulumi.String("example"),
			GitConfig: &sagemaker.CodeRepositoryGitConfigArgs{
				RepositoryUrl: pulumi.String("https://github.com/github/docs.git"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sagemaker.CodeRepository;
import com.pulumi.aws.sagemaker.CodeRepositoryArgs;
import com.pulumi.aws.sagemaker.inputs.CodeRepositoryGitConfigArgs;
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 CodeRepository("example", CodeRepositoryArgs.builder()        
            .codeRepositoryName("example")
            .gitConfig(CodeRepositoryGitConfigArgs.builder()
                .repositoryUrl("https://github.com/github/docs.git")
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.sagemaker.CodeRepository("example",
    code_repository_name="example",
    git_config=aws.sagemaker.CodeRepositoryGitConfigArgs(
        repository_url="https://github.com/github/docs.git",
    ))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.sagemaker.CodeRepository("example", {
    codeRepositoryName: "example",
    gitConfig: {
        repositoryUrl: "https://github.com/github/docs.git",
    },
});
resources:
  example:
    type: aws:sagemaker:CodeRepository
    properties:
      codeRepositoryName: example
      gitConfig:
        repositoryUrl: https://github.com/github/docs.git

Example with Secret

using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var exampleSecret = new Aws.SecretsManager.Secret("exampleSecret");

    var exampleSecretVersion = new Aws.SecretsManager.SecretVersion("exampleSecretVersion", new()
    {
        SecretId = exampleSecret.Id,
        SecretString = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["username"] = "example",
            ["password"] = "example",
        }),
    });

    var exampleCodeRepository = new Aws.Sagemaker.CodeRepository("exampleCodeRepository", new()
    {
        CodeRepositoryName = "example",
        GitConfig = new Aws.Sagemaker.Inputs.CodeRepositoryGitConfigArgs
        {
            RepositoryUrl = "https://github.com/github/docs.git",
            SecretArn = exampleSecret.Arn,
        },
    }, new CustomResourceOptions
    {
        DependsOn = new[]
        {
            exampleSecretVersion,
        },
    });

});
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/sagemaker"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/secretsmanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleSecret, err := secretsmanager.NewSecret(ctx, "exampleSecret", nil)
		if err != nil {
			return err
		}
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"username": "example",
			"password": "example",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		exampleSecretVersion, err := secretsmanager.NewSecretVersion(ctx, "exampleSecretVersion", &secretsmanager.SecretVersionArgs{
			SecretId:     exampleSecret.ID(),
			SecretString: pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		_, err = sagemaker.NewCodeRepository(ctx, "exampleCodeRepository", &sagemaker.CodeRepositoryArgs{
			CodeRepositoryName: pulumi.String("example"),
			GitConfig: &sagemaker.CodeRepositoryGitConfigArgs{
				RepositoryUrl: pulumi.String("https://github.com/github/docs.git"),
				SecretArn:     exampleSecret.Arn,
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			exampleSecretVersion,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.secretsmanager.Secret;
import com.pulumi.aws.secretsmanager.SecretVersion;
import com.pulumi.aws.secretsmanager.SecretVersionArgs;
import com.pulumi.aws.sagemaker.CodeRepository;
import com.pulumi.aws.sagemaker.CodeRepositoryArgs;
import com.pulumi.aws.sagemaker.inputs.CodeRepositoryGitConfigArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import com.pulumi.resources.CustomResourceOptions;
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 exampleSecret = new Secret("exampleSecret");

        var exampleSecretVersion = new SecretVersion("exampleSecretVersion", SecretVersionArgs.builder()        
            .secretId(exampleSecret.id())
            .secretString(serializeJson(
                jsonObject(
                    jsonProperty("username", "example"),
                    jsonProperty("password", "example")
                )))
            .build());

        var exampleCodeRepository = new CodeRepository("exampleCodeRepository", CodeRepositoryArgs.builder()        
            .codeRepositoryName("example")
            .gitConfig(CodeRepositoryGitConfigArgs.builder()
                .repositoryUrl("https://github.com/github/docs.git")
                .secretArn(exampleSecret.arn())
                .build())
            .build(), CustomResourceOptions.builder()
                .dependsOn(exampleSecretVersion)
                .build());

    }
}
import pulumi
import json
import pulumi_aws as aws

example_secret = aws.secretsmanager.Secret("exampleSecret")
example_secret_version = aws.secretsmanager.SecretVersion("exampleSecretVersion",
    secret_id=example_secret.id,
    secret_string=json.dumps({
        "username": "example",
        "password": "example",
    }))
example_code_repository = aws.sagemaker.CodeRepository("exampleCodeRepository",
    code_repository_name="example",
    git_config=aws.sagemaker.CodeRepositoryGitConfigArgs(
        repository_url="https://github.com/github/docs.git",
        secret_arn=example_secret.arn,
    ),
    opts=pulumi.ResourceOptions(depends_on=[example_secret_version]))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleSecret = new aws.secretsmanager.Secret("exampleSecret", {});
const exampleSecretVersion = new aws.secretsmanager.SecretVersion("exampleSecretVersion", {
    secretId: exampleSecret.id,
    secretString: JSON.stringify({
        username: "example",
        password: "example",
    }),
});
const exampleCodeRepository = new aws.sagemaker.CodeRepository("exampleCodeRepository", {
    codeRepositoryName: "example",
    gitConfig: {
        repositoryUrl: "https://github.com/github/docs.git",
        secretArn: exampleSecret.arn,
    },
}, {
    dependsOn: [exampleSecretVersion],
});
resources:
  exampleSecret:
    type: aws:secretsmanager:Secret
  exampleSecretVersion:
    type: aws:secretsmanager:SecretVersion
    properties:
      secretId: ${exampleSecret.id}
      secretString:
        fn::toJSON:
          username: example
          password: example
  exampleCodeRepository:
    type: aws:sagemaker:CodeRepository
    properties:
      codeRepositoryName: example
      gitConfig:
        repositoryUrl: https://github.com/github/docs.git
        secretArn: ${exampleSecret.arn}
    options:
      dependson:
        - ${exampleSecretVersion}

Create CodeRepository Resource

new CodeRepository(name: string, args: CodeRepositoryArgs, opts?: CustomResourceOptions);
@overload
def CodeRepository(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   code_repository_name: Optional[str] = None,
                   git_config: Optional[CodeRepositoryGitConfigArgs] = None,
                   tags: Optional[Mapping[str, str]] = None)
@overload
def CodeRepository(resource_name: str,
                   args: CodeRepositoryArgs,
                   opts: Optional[ResourceOptions] = None)
func NewCodeRepository(ctx *Context, name string, args CodeRepositoryArgs, opts ...ResourceOption) (*CodeRepository, error)
public CodeRepository(string name, CodeRepositoryArgs args, CustomResourceOptions? opts = null)
public CodeRepository(String name, CodeRepositoryArgs args)
public CodeRepository(String name, CodeRepositoryArgs args, CustomResourceOptions options)
type: aws:sagemaker:CodeRepository
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args CodeRepositoryArgs
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 CodeRepositoryArgs
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 CodeRepositoryArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args CodeRepositoryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args CodeRepositoryArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

CodeRepository Resource Properties

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

Inputs

The CodeRepository resource accepts the following input properties:

CodeRepositoryName string

The name of the Code Repository (must be unique).

GitConfig Pulumi.Aws.Sagemaker.Inputs.CodeRepositoryGitConfigArgs

Specifies details about the repository. see Git Config details below.

Tags Dictionary<string, string>

A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

CodeRepositoryName string

The name of the Code Repository (must be unique).

GitConfig CodeRepositoryGitConfigArgs

Specifies details about the repository. see Git Config details below.

Tags map[string]string

A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

codeRepositoryName String

The name of the Code Repository (must be unique).

gitConfig CodeRepositoryGitConfigArgs

Specifies details about the repository. see Git Config details below.

tags Map<String,String>

A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

codeRepositoryName string

The name of the Code Repository (must be unique).

gitConfig CodeRepositoryGitConfigArgs

Specifies details about the repository. see Git Config details below.

tags {[key: string]: string}

A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

code_repository_name str

The name of the Code Repository (must be unique).

git_config CodeRepositoryGitConfigArgs

Specifies details about the repository. see Git Config details below.

tags Mapping[str, str]

A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

codeRepositoryName String

The name of the Code Repository (must be unique).

gitConfig Property Map

Specifies details about the repository. see Git Config details below.

tags Map<String>

A map of tags to assign to the resource. 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 CodeRepository resource produces the following output properties:

Arn string

The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.

Id string

The provider-assigned unique ID for this managed resource.

TagsAll Dictionary<string, string>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Arn string

The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.

Id string

The provider-assigned unique ID for this managed resource.

TagsAll map[string]string

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

arn String

The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.

id String

The provider-assigned unique ID for this managed resource.

tagsAll Map<String,String>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

arn string

The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.

id string

The provider-assigned unique ID for this managed resource.

tagsAll {[key: string]: string}

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

arn str

The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.

id str

The provider-assigned unique ID for this managed resource.

tags_all Mapping[str, str]

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

arn String

The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.

id String

The provider-assigned unique ID for this managed resource.

tagsAll Map<String>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Look up Existing CodeRepository Resource

Get an existing CodeRepository 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?: CodeRepositoryState, opts?: CustomResourceOptions): CodeRepository
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        code_repository_name: Optional[str] = None,
        git_config: Optional[CodeRepositoryGitConfigArgs] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None) -> CodeRepository
func GetCodeRepository(ctx *Context, name string, id IDInput, state *CodeRepositoryState, opts ...ResourceOption) (*CodeRepository, error)
public static CodeRepository Get(string name, Input<string> id, CodeRepositoryState? state, CustomResourceOptions? opts = null)
public static CodeRepository get(String name, Output<String> id, CodeRepositoryState 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 Amazon Resource Name (ARN) assigned by AWS to this Code Repository.

CodeRepositoryName string

The name of the Code Repository (must be unique).

GitConfig Pulumi.Aws.Sagemaker.Inputs.CodeRepositoryGitConfigArgs

Specifies details about the repository. see Git Config details below.

Tags Dictionary<string, string>

A map of tags to assign to the resource. 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.

Arn string

The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.

CodeRepositoryName string

The name of the Code Repository (must be unique).

GitConfig CodeRepositoryGitConfigArgs

Specifies details about the repository. see Git Config details below.

Tags map[string]string

A map of tags to assign to the resource. 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.

arn String

The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.

codeRepositoryName String

The name of the Code Repository (must be unique).

gitConfig CodeRepositoryGitConfigArgs

Specifies details about the repository. see Git Config details below.

tags Map<String,String>

A map of tags to assign to the resource. 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.

arn string

The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.

codeRepositoryName string

The name of the Code Repository (must be unique).

gitConfig CodeRepositoryGitConfigArgs

Specifies details about the repository. see Git Config details below.

tags {[key: string]: string}

A map of tags to assign to the resource. 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.

arn str

The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.

code_repository_name str

The name of the Code Repository (must be unique).

git_config CodeRepositoryGitConfigArgs

Specifies details about the repository. see Git Config details below.

tags Mapping[str, str]

A map of tags to assign to the resource. 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.

arn String

The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.

codeRepositoryName String

The name of the Code Repository (must be unique).

gitConfig Property Map

Specifies details about the repository. see Git Config details below.

tags Map<String>

A map of tags to assign to the resource. 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.

Supporting Types

CodeRepositoryGitConfig

RepositoryUrl string

The URL where the Git repository is located.

Branch string

The default branch for the Git repository.

SecretArn string

The Amazon Resource Name (ARN) of the AWS Secrets Manager secret that contains the credentials used to access the git repository. The secret must have a staging label of AWSCURRENT and must be in the following format: {"username": UserName, "password": Password}

RepositoryUrl string

The URL where the Git repository is located.

Branch string

The default branch for the Git repository.

SecretArn string

The Amazon Resource Name (ARN) of the AWS Secrets Manager secret that contains the credentials used to access the git repository. The secret must have a staging label of AWSCURRENT and must be in the following format: {"username": UserName, "password": Password}

repositoryUrl String

The URL where the Git repository is located.

branch String

The default branch for the Git repository.

secretArn String

The Amazon Resource Name (ARN) of the AWS Secrets Manager secret that contains the credentials used to access the git repository. The secret must have a staging label of AWSCURRENT and must be in the following format: {"username": UserName, "password": Password}

repositoryUrl string

The URL where the Git repository is located.

branch string

The default branch for the Git repository.

secretArn string

The Amazon Resource Name (ARN) of the AWS Secrets Manager secret that contains the credentials used to access the git repository. The secret must have a staging label of AWSCURRENT and must be in the following format: {"username": UserName, "password": Password}

repository_url str

The URL where the Git repository is located.

branch str

The default branch for the Git repository.

secret_arn str

The Amazon Resource Name (ARN) of the AWS Secrets Manager secret that contains the credentials used to access the git repository. The secret must have a staging label of AWSCURRENT and must be in the following format: {"username": UserName, "password": Password}

repositoryUrl String

The URL where the Git repository is located.

branch String

The default branch for the Git repository.

secretArn String

The Amazon Resource Name (ARN) of the AWS Secrets Manager secret that contains the credentials used to access the git repository. The secret must have a staging label of AWSCURRENT and must be in the following format: {"username": UserName, "password": Password}

Import

SageMaker Code Repositories can be imported using the name, e.g.,

 $ pulumi import aws:sagemaker/codeRepository:CodeRepository test_code_repository my-code-repo

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.