variable "aiceberg_external_id" {
description = "External ID provided by Aiceberg"
type = string
sensitive = true
}
resource "aws_iam_role" "aiceberg_bedrock" {
name = "AicebergBedrockAccessRole"
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Principal = {
AWS = "arn:aws:iam::119554510492:root"
}
Action = "sts:AssumeRole"
Condition = {
StringEquals = {
"sts:ExternalId" = var.aiceberg_external_id
}
}
}
]
})
}
resource "aws_iam_role_policy" "aiceberg_bedrock_invoke" {
name = "BedrockInvokePolicy"
role = aws_iam_role.aiceberg_bedrock.id
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Sid = "AicebergBedrockInvoke"
Effect = "Allow"
Action = [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
]
Resource = "arn:aws:bedrock:*:*:foundation-model/*"
}
]
})
}
output "role_arn" {
description = "ARN of the created IAM Role"
value = aws_iam_role.aiceberg_bedrock.arn
}