Provides a SageMaker Model Package Group Policy resource.
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))
}
This resource supports the following arguments:
model_package_group_name
- (Required) The name of the model package group.This resource exports the following attributes in addition to the arguments above:
id
- The name of the Model Package Package Group.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