Skip to content

Resource: awsSagemakerModelPackageGroupPolicy

Provides a SageMaker Model Package Group Policy 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";
const awsSagemakerModelPackageGroupExample =
  new aws.sagemakerModelPackageGroup.SagemakerModelPackageGroup(
    this,
    "example",
    {
      modelPackageGroupName: "example",
    }
  );
const dataAwsCallerIdentityCurrent =
  new aws.dataAwsCallerIdentity.DataAwsCallerIdentity(this, "current", {});
const dataAwsIamPolicyDocumentExample =
  new aws.dataAwsIamPolicyDocument.DataAwsIamPolicyDocument(this, "example_2", {
    statement: [
      {
        actions: [
          "sagemaker:DescribeModelPackage",
          "sagemaker:ListModelPackages",
        ],
        principals: [
          {
            identifiers: [dataAwsCallerIdentityCurrent.accountId],
            type: "AWS",
          },
        ],
        resources: [awsSagemakerModelPackageGroupExample.arn],
        sid: "AddPermModelPackageGroup",
      },
    ],
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAwsIamPolicyDocumentExample.overrideLogicalId("example");
const awsSagemakerModelPackageGroupPolicyExample =
  new aws.sagemakerModelPackageGroupPolicy.SagemakerModelPackageGroupPolicy(
    this,
    "example_3",
    {
      modelPackageGroupName:
        awsSagemakerModelPackageGroupExample.modelPackageGroupName,
      resourcePolicy: `\${jsonencode(jsondecode(${dataAwsIamPolicyDocumentExample.json}))}`,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsSagemakerModelPackageGroupPolicyExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • modelPackageGroupName - (Required) The name of the model package group.

Attributes Reference

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

  • id - The name of the Model Package Package Group.

Import

SageMaker Model Package Groups can be imported using the name, e.g.,

$ terraform import aws_sagemaker_model_package_group_policy.example example