Skip to content

Commit 1003580

Browse files
anajmi07athewsey
authored andcommitted
Make policies granular
1 parent e0221bd commit 1003580

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

infra/modules/agentcore-iam-role/bedrock-agentcore-policy.tf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ resource "aws_iam_policy" "bedrock_permissions" {
1111
"bedrock:InvokeModel",
1212
"bedrock:InvokeModelWithResponseStream"
1313
]
14-
Resource = "*"
14+
Resource = [
15+
"arn:aws:bedrock:${data.aws_region.current.name}::foundation-model/anthropic.*",
16+
"arn:aws:bedrock:${data.aws_region.current.name}::foundation-model/amazon.*",
17+
"arn:aws:bedrock:${data.aws_region.current.name}::foundation-model/meta.*"
18+
]
1519
}
1620
]
1721
})
@@ -100,7 +104,9 @@ resource "aws_iam_policy" "monitoring_permissions" {
100104
"xray:GetSamplingRules",
101105
"xray:GetSamplingTargets"
102106
]
103-
Resource = "*"
107+
Resource = [
108+
"arn:aws:xray:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:trace/*"
109+
]
104110
},
105111
{
106112
Effect = "Allow"

infra/modules/knowledge-base/main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ resource "aws_iam_role_policy" "bedrock_kb_sample_kb_model" {
77
Version = "2012-10-17"
88
Statement = [
99
{
10-
Action = ["aoss:*"]
10+
Action = [
11+
"aoss:APIAccessAll",
12+
"aoss:DashboardsAccessAll"
13+
]
1114
Effect = "Allow"
1215
Resource = [var.opensearch_arn]
1316
},

0 commit comments

Comments
 (0)