Try AWS Native preview for resources not in the classic version.
aws.sagemaker.CodeRepository
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
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/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
})
}
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/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 {
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:
- Code
Repository stringName The name of the Code Repository (must be unique).
- Git
Config Pulumi.Aws. Sagemaker. Inputs. Code Repository 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_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- Code
Repository stringName 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.
- 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.
- code
Repository StringName The name of the Code Repository (must be unique).
- git
Config 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_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- code
Repository stringName The name of the Code Repository (must be unique).
- git
Config 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_tags
configuration 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_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- code
Repository StringName The name of the Code Repository (must be unique).
- git
Config 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_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.
- Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.Please use
tags
instead.
- 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.
- map[string]string
A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.Please use
tags
instead.
- 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.
- Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.Please use
tags
instead.
- 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.
- {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.Please use
tags
instead.
- 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.
- Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.Please use
tags
instead.
- 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.
- Map<String>
A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.Please use
tags
instead.
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.
- Arn string
The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
- Code
Repository stringName The name of the Code Repository (must be unique).
- Git
Config Pulumi.Aws. Sagemaker. Inputs. Code Repository 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_tags
configuration 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_tags
configuration block.Please use
tags
instead.
- Arn string
The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
- Code
Repository stringName 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.
- 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.- map[string]string
A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.Please use
tags
instead.
- arn String
The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
- code
Repository StringName The name of the Code Repository (must be unique).
- git
Config 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_tags
configuration 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_tags
configuration block.Please use
tags
instead.
- arn string
The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
- code
Repository stringName The name of the Code Repository (must be unique).
- git
Config 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_tags
configuration 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_tags
configuration block.Please use
tags
instead.
- 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_tags
configuration 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_tags
configuration block.Please use
tags
instead.
- arn String
The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
- code
Repository StringName The name of the Code Repository (must be unique).
- git
Config 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_tags
configuration 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_tags
configuration block.Please use
tags
instead.
Supporting Types
CodeRepositoryGitConfig, CodeRepositoryGitConfigArgs
- Repository
Url string The URL where the Git repository is located.
- Branch string
The default branch for the Git repository.
- Secret
Arn 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 string The URL where the Git repository is located.
- Branch string
The default branch for the Git repository.
- Secret
Arn 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 String The URL where the Git repository is located.
- branch String
The default branch for the Git repository.
- secret
Arn 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 string The URL where the Git repository is located.
- branch string
The default branch for the Git repository.
- secret
Arn 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}
- repository
Url String The URL where the Git repository is located.
- branch String
The default branch for the Git repository.
- secret
Arn 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 Code Repositories using the name
. For example:
$ 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.
Try AWS Native preview for resources not in the classic version.