aws.sagemaker.CodeRepository
Explore with Pulumi AI
Provides a SageMaker AI Code Repository resource.
Example Usage
Basic usage
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",
    },
});
import pulumi
import pulumi_aws as aws
example = aws.sagemaker.CodeRepository("example",
    code_repository_name="example",
    git_config={
        "repository_url": "https://github.com/github/docs.git",
    })
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/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
	})
}
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 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());
    }
}
resources:
  example:
    type: aws:sagemaker:CodeRepository
    properties:
      codeRepositoryName: example
      gitConfig:
        repositoryUrl: https://github.com/github/docs.git
Example with Secret
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.secretsmanager.Secret("example", {name: "example"});
const exampleSecretVersion = new aws.secretsmanager.SecretVersion("example", {
    secretId: example.id,
    secretString: JSON.stringify({
        username: "example",
        password: "example",
    }),
});
const exampleCodeRepository = new aws.sagemaker.CodeRepository("example", {
    codeRepositoryName: "example",
    gitConfig: {
        repositoryUrl: "https://github.com/github/docs.git",
        secretArn: example.arn,
    },
}, {
    dependsOn: [exampleSecretVersion],
});
import pulumi
import json
import pulumi_aws as aws
example = aws.secretsmanager.Secret("example", name="example")
example_secret_version = aws.secretsmanager.SecretVersion("example",
    secret_id=example.id,
    secret_string=json.dumps({
        "username": "example",
        "password": "example",
    }))
example_code_repository = aws.sagemaker.CodeRepository("example",
    code_repository_name="example",
    git_config={
        "repository_url": "https://github.com/github/docs.git",
        "secret_arn": example.arn,
    },
    opts = pulumi.ResourceOptions(depends_on=[example_secret_version]))
package main
import (
	"encoding/json"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sagemaker"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/secretsmanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := secretsmanager.NewSecret(ctx, "example", &secretsmanager.SecretArgs{
			Name: pulumi.String("example"),
		})
		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, "example", &secretsmanager.SecretVersionArgs{
			SecretId:     example.ID(),
			SecretString: pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		_, err = sagemaker.NewCodeRepository(ctx, "example", &sagemaker.CodeRepositoryArgs{
			CodeRepositoryName: pulumi.String("example"),
			GitConfig: &sagemaker.CodeRepositoryGitConfigArgs{
				RepositoryUrl: pulumi.String("https://github.com/github/docs.git"),
				SecretArn:     example.Arn,
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			exampleSecretVersion,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var example = new Aws.SecretsManager.Secret("example", new()
    {
        Name = "example",
    });
    var exampleSecretVersion = new Aws.SecretsManager.SecretVersion("example", new()
    {
        SecretId = example.Id,
        SecretString = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["username"] = "example",
            ["password"] = "example",
        }),
    });
    var exampleCodeRepository = new Aws.Sagemaker.CodeRepository("example", new()
    {
        CodeRepositoryName = "example",
        GitConfig = new Aws.Sagemaker.Inputs.CodeRepositoryGitConfigArgs
        {
            RepositoryUrl = "https://github.com/github/docs.git",
            SecretArn = example.Arn,
        },
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            exampleSecretVersion,
        },
    });
});
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.SecretArgs;
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 example = new Secret("example", SecretArgs.builder()
            .name("example")
            .build());
        var exampleSecretVersion = new SecretVersion("exampleSecretVersion", SecretVersionArgs.builder()
            .secretId(example.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(example.arn())
                .build())
            .build(), CustomResourceOptions.builder()
                .dependsOn(exampleSecretVersion)
                .build());
    }
}
resources:
  example:
    type: aws:secretsmanager:Secret
    properties:
      name: example
  exampleSecretVersion:
    type: aws:secretsmanager:SecretVersion
    name: example
    properties:
      secretId: ${example.id}
      secretString:
        fn::toJSON:
          username: example
          password: example
  exampleCodeRepository:
    type: aws:sagemaker:CodeRepository
    name: example
    properties:
      codeRepositoryName: example
      gitConfig:
        repositoryUrl: https://github.com/github/docs.git
        secretArn: ${example.arn}
    options:
      dependsOn:
        - ${exampleSecretVersion}
Create CodeRepository Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CodeRepository(name: string, args: CodeRepositoryArgs, opts?: CustomResourceOptions);@overload
def CodeRepository(resource_name: str,
                   args: CodeRepositoryArgs,
                   opts: Optional[ResourceOptions] = None)
@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)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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var codeRepositoryResource = new Aws.Sagemaker.CodeRepository("codeRepositoryResource", new()
{
    CodeRepositoryName = "string",
    GitConfig = new Aws.Sagemaker.Inputs.CodeRepositoryGitConfigArgs
    {
        RepositoryUrl = "string",
        Branch = "string",
        SecretArn = "string",
    },
    Tags = 
    {
        { "string", "string" },
    },
});
example, err := sagemaker.NewCodeRepository(ctx, "codeRepositoryResource", &sagemaker.CodeRepositoryArgs{
	CodeRepositoryName: pulumi.String("string"),
	GitConfig: &sagemaker.CodeRepositoryGitConfigArgs{
		RepositoryUrl: pulumi.String("string"),
		Branch:        pulumi.String("string"),
		SecretArn:     pulumi.String("string"),
	},
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
var codeRepositoryResource = new CodeRepository("codeRepositoryResource", CodeRepositoryArgs.builder()
    .codeRepositoryName("string")
    .gitConfig(CodeRepositoryGitConfigArgs.builder()
        .repositoryUrl("string")
        .branch("string")
        .secretArn("string")
        .build())
    .tags(Map.of("string", "string"))
    .build());
code_repository_resource = aws.sagemaker.CodeRepository("codeRepositoryResource",
    code_repository_name="string",
    git_config={
        "repository_url": "string",
        "branch": "string",
        "secret_arn": "string",
    },
    tags={
        "string": "string",
    })
const codeRepositoryResource = new aws.sagemaker.CodeRepository("codeRepositoryResource", {
    codeRepositoryName: "string",
    gitConfig: {
        repositoryUrl: "string",
        branch: "string",
        secretArn: "string",
    },
    tags: {
        string: "string",
    },
});
type: aws:sagemaker:CodeRepository
properties:
    codeRepositoryName: string
    gitConfig:
        branch: string
        repositoryUrl: string
        secretArn: string
    tags:
        string: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The CodeRepository resource accepts the following input properties:
- CodeRepository stringName 
- The name of the Code Repository (must be unique).
- GitConfig CodeRepository Git Config 
- Specifies details about the repository. see Git Config details below.
- Dictionary<string, string>
- A map of tags to assign to the resource. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- CodeRepository stringName 
- The name of the Code Repository (must be unique).
- GitConfig CodeRepository Git Config Args 
- Specifies details about the repository. see Git Config details below.
- map[string]string
- A map of tags to assign to the resource. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- codeRepository StringName 
- The name of the Code Repository (must be unique).
- gitConfig CodeRepository Git Config 
- Specifies details about the repository. see Git Config details below.
- Map<String,String>
- A map of tags to assign to the resource. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- codeRepository stringName 
- The name of the Code Repository (must be unique).
- gitConfig CodeRepository Git Config 
- Specifies details about the repository. see Git Config details below.
- {[key: string]: string}
- A map of tags to assign to the resource. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- code_repository_ strname 
- The name of the Code Repository (must be unique).
- git_config CodeRepository Git Config Args 
- Specifies details about the repository. see Git Config details below.
- Mapping[str, str]
- A map of tags to assign to the resource. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- codeRepository StringName 
- The name of the Code Repository (must be unique).
- gitConfig Property Map
- Specifies details about the repository. see Git Config details below.
- Map<String>
- A map of tags to assign to the resource. If configured with a provider default_tagsconfiguration 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:
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) -> CodeRepositoryfunc 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)resources:  _:    type: aws:sagemaker:CodeRepository    get:      id: ${id}- 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.
- Arn string
- The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
- CodeRepository stringName 
- The name of the Code Repository (must be unique).
- GitConfig CodeRepository Git Config 
- Specifies details about the repository. see Git Config details below.
- Dictionary<string, string>
- A map of tags to assign to the resource. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- Arn string
- The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
- CodeRepository stringName 
- The name of the Code Repository (must be unique).
- GitConfig CodeRepository Git Config Args 
- Specifies details about the repository. see Git Config details below.
- map[string]string
- A map of tags to assign to the resource. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- map[string]string
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- arn String
- The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
- codeRepository StringName 
- The name of the Code Repository (must be unique).
- gitConfig CodeRepository Git Config 
- Specifies details about the repository. see Git Config details below.
- Map<String,String>
- A map of tags to assign to the resource. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- arn string
- The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
- codeRepository stringName 
- The name of the Code Repository (must be unique).
- gitConfig CodeRepository Git Config 
- Specifies details about the repository. see Git Config details below.
- {[key: string]: string}
- A map of tags to assign to the resource. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- arn str
- The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
- code_repository_ strname 
- The name of the Code Repository (must be unique).
- git_config CodeRepository Git Config Args 
- Specifies details about the repository. see Git Config details below.
- Mapping[str, str]
- A map of tags to assign to the resource. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- Mapping[str, str]
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- arn String
- The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
- codeRepository StringName 
- The name of the Code Repository (must be unique).
- gitConfig Property Map
- Specifies details about the repository. see Git Config details below.
- Map<String>
- A map of tags to assign to the resource. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- Map<String>
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
Supporting Types
CodeRepositoryGitConfig, CodeRepositoryGitConfigArgs        
- 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
Using pulumi import, import SageMaker AI Code Repositories using the name. For example:
$ pulumi import aws:sagemaker/codeRepository:CodeRepository test_code_repository my-code-repo
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 awsTerraform Provider.