Resource: aws_sagemaker_model_package_group_policy

Provides a SageMaker Model Package Group Policy resource.

Example Usage

Basic usage

data "aws_caller_identity" "current" {}

data "aws_iam_policy_document" "example" {
  statement {
    sid       = "AddPermModelPackageGroup"
    actions   = ["sagemaker:DescribeModelPackage", "sagemaker:ListModelPackages"]
    resources = [aws_sagemaker_model_package_group.example.arn]
    principals {
      identifiers = [data.aws_caller_identity.current.account_id]
      type        = "AWS"
    }
  }
}

resource "aws_sagemaker_model_package_group" "example" {
  model_package_group_name = "example"
}

resource "aws_sagemaker_model_package_group_policy" "example" {
  model_package_group_name = aws_sagemaker_model_package_group.example.model_package_group_name
  resource_policy          = jsonencode(jsondecode(data.aws_iam_policy_document.example.json))
}

Argument Reference

This resource supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import SageMaker Model Package Groups using the name. For example:

import {
  to = aws_sagemaker_model_package_group_policy.example
  id = "example"
}

Using terraform import, import SageMaker Model Package Groups using the name. For example:

% terraform import aws_sagemaker_model_package_group_policy.example example