Resource: aws_bedrock_model_invocation_logging_configuration

Manages Bedrock model invocation logging configuration.

Example Usage

Basic Usage

data "aws_caller_identity" "current" {}

resource aws_s3_bucket example {
  bucket        = "example"
  force_destroy = true
  lifecycle {
    ignore_changes = [
      tags["CreatorId"], tags["CreatorName"],
    ]
  }
}

resource "aws_s3_bucket_policy" "example" {
  bucket = aws_s3_bucket.example.bucket

  policy = <<EOF
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "bedrock.amazonaws.com"
      },
      "Action": [
        "s3:*"
      ],
      "Resource": [
        "${aws_s3_bucket.example.arn}/*"
      ],
      "Condition": {
        "StringEquals": {
          "aws:SourceAccount": "${data.aws_caller_identity.current.account_id}"
        },
        "ArnLike": {
          "aws:SourceArn": "arn:aws:bedrock:us-east-1:${data.aws_caller_identity.current.account_id}:*"
        }
      }
    }
  ]
}
EOF
}

resource "aws_bedrock_model_invocation_logging_configuration" "example" {
  depends_on = [
    aws_s3_bucket_policy.example
  ]

  logging_config {
    embedding_data_delivery_enabled = true
    image_data_delivery_enabled     = true
    text_data_delivery_enabled      = true
    s3_config {
      bucket_name = aws_s3_bucket.example.id
      key_prefix  = "bedrock"
    }
  }
}

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 Bedrock Invocation Logging Configuration using the id set to the AWS Region. For example:

import {
  to = aws_bedrock_model_invocation_logging_configuration.my_config
  id = "us-east-1"
}

Using terraform import, import Bedrock custom model using the id set to the AWS Region. For example:

% terraform import aws_bedrock_model_invocation_logging_configuration.my_config us-east-1