Skip to content

Commit 29e6f96

Browse files
committed
fix: Grant bedrock access to dma service account
1 parent 8b5982d commit 29e6f96

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

modules/eks/roles.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ module "dfshell_role" {
7676
}
7777
}
7878

79+
# dma
80+
module "dma_role" {
81+
count = 1
82+
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
83+
role_name = "${var.deployment_name}-${var.dma_service_account_name}"
84+
85+
oidc_providers = {
86+
ex = {
87+
provider_arn = module.eks.oidc_provider_arn
88+
namespace_service_accounts = ["${var.deployment_name}:${var.dma_service_account_name}"]
89+
}
90+
}
91+
}
92+
7993
# worker_portal
8094
module "worker_portal_role" {
8195
count = 1
@@ -249,6 +263,12 @@ resource "aws_iam_role_policy_attachment" "bedrock_dfshell_attachment" {
249263
policy_arn = aws_iam_policy.bedrock_access_policy[0].arn
250264
}
251265

266+
resource "aws_iam_role_policy_attachment" "bedrock_dma_attachment" {
267+
count = var.k8s_access_bedrock ? 1 : 0
268+
role = module.dma_role[0].iam_role_name
269+
policy_arn = aws_iam_policy.bedrock_access_policy[0].arn
270+
}
271+
252272
resource "aws_iam_role_policy_attachment" "bedrock_server_attachment" {
253273
count = var.k8s_access_bedrock ? 1 : 0
254274
role = module.server_role[0].iam_role_name

modules/eks/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ variable "dfshell_service_account_name" {
135135
description = "Name of the service account for dfshell"
136136
}
137137

138+
variable "dma_service_account_name" {
139+
type = string
140+
default = "datafold-dma"
141+
description = "Name of the service account for dma"
142+
}
143+
138144
variable "worker_portal_service_account_name" {
139145
type = string
140146
default = "datafold-worker-portal"

0 commit comments

Comments
 (0)