Skip to content

Resource: awsSagemakerCodeRepository

Provides a SageMaker Code Repository resource.

Example Usage

Basic usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.sagemakerCodeRepository.SagemakerCodeRepository(this, "example", {
  codeRepositoryName: "example",
  gitConfig: {
    repositoryUrl: "https://github.com/hashicorp/terraform-provider-aws.git",
  },
});

Example with Secret

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsSecretsmanagerSecretExample =
  new aws.secretsmanagerSecret.SecretsmanagerSecret(this, "example", {
    name: "example",
  });
const awsSecretsmanagerSecretVersionExample =
  new aws.secretsmanagerSecretVersion.SecretsmanagerSecretVersion(
    this,
    "example_1",
    {
      secretId: awsSecretsmanagerSecretExample.id,
      secretString:
        '${jsonencode({ username = "example", password = "example" })}',
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsSecretsmanagerSecretVersionExample.overrideLogicalId("example");
const awsSagemakerCodeRepositoryExample =
  new aws.sagemakerCodeRepository.SagemakerCodeRepository(this, "example_2", {
    codeRepositoryName: "example",
    depends_on: [`\${${awsSecretsmanagerSecretVersionExample.fqn}}`],
    gitConfig: {
      repositoryUrl: "https://github.com/hashicorp/terraform-provider-aws.git",
      secretArn: awsSecretsmanagerSecretExample.arn,
    },
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsSagemakerCodeRepositoryExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • codeRepositoryName - (Required) The name of the Code Repository (must be unique).
  • gitConfig - (Required) Specifies details about the repository. see Git Config details below.
  • tags - (Optional) A map of tags to assign to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Git Config

  • repositoryUrl - (Required) The URL where the Git repository is located.
  • branch - (Optional) The default branch for the Git repository.
  • secretArn - (Optional) 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}

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The name of the Code Repository.
  • arn - The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

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

$ terraform import aws_sagemaker_code_repository.test_code_repository my-code-repo