Skip to content

Commit

Permalink
Add CPU release repo access
Browse files Browse the repository at this point in the history
Signed-off-by: kevin <[email protected]>
  • Loading branch information
khluu committed Dec 18, 2024
1 parent f62caf9 commit c899dbb
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion infra/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ resource "aws_iam_policy" "premerge_ecr_public_write_access_policy" {
"ecr-public:CompleteLayerUpload",
"ecr-public:DescribeImageTags",
"ecr-public:DescribeImages",
"ecr-public:DescribeRegistries",
"ecr-public:DescribeRegistries",
"ecr-public:DescribeRepositories",
"ecr-public:GetAuthorizationToken",
"ecr-public:GetRegistryCatalogData",
Expand All @@ -330,6 +330,14 @@ resource "aws_iam_policy" "premerge_ecr_public_write_access_policy" {
"sts:GetServiceBearerToken"
]
Resource = "arn:aws:ecr-public::936637512419:repository/vllm-ci-test-repo"
},
{
Effect = "Allow"
Action = [
"ecr-public:GetAuthorizationToken",
"sts:GetServiceBearerToken"
],
Resource = "*"
}]
})
}
Expand Down Expand Up @@ -421,6 +429,38 @@ resource "aws_iam_policy" "release_ecr_public_read_write_access_policy" {
})
}

resource "aws_iam_policy" "cpu_release_ecr_public_read_write_access_policy" {
name = "cpu-release-ecr-public-read-write-access-policy"
description = "Policy to push and pull images from release ECR"

policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Action = [
"ecr-public:BatchCheckLayerAvailability",
"ecr-public:CompleteLayerUpload",
"ecr-public:DescribeImageTags",
"ecr-public:DescribeImages",
"ecr-public:DescribeRegistries",
"ecr-public:DescribeRepositories",
"ecr-public:GetAuthorizationToken",
"ecr-public:GetRegistryCatalogData",
"ecr-public:GetRepositoryCatalogData",
"ecr-public:GetRepositoryPolicy",
"ecr-public:InitiateLayerUpload",
"ecr-public:ListTagsForResource",
"ecr-public:PutImage",
"ecr-public:PutRegistryCatalogData",
"ecr-public:TagResource",
"ecr-public:UploadLayerPart",
"sts:GetServiceBearerToken"
]
Resource = "arn:aws:ecr-public::936637512419:repository/vllm-cpu-release-repo"
}]
})
}

resource "aws_iam_policy" "bk_stack_secrets_access" {
name = "access-to-bk-stack-secrets"

Expand Down Expand Up @@ -535,6 +575,14 @@ resource "aws_iam_role_policy_attachment" "release_ecr_public_read_write_access"
policy_arn = aws_iam_policy.release_ecr_public_read_write_access_policy.arn
}

resource "aws_iam_role_policy_attachment" "cpu_release_ecr_public_read_write_access" {
for_each = merge(
aws_cloudformation_stack.bk_queue_postmerge
)
role = each.value.outputs.InstanceRoleName
policy_arn = aws_iam_policy.cpu_release_ecr_public_read_write_access_policy.arn
}

resource "aws_iam_role_policy_attachment" "bk_stack_secrets_access" {
for_each = merge(
aws_cloudformation_stack.bk_queue,
Expand Down

0 comments on commit c899dbb

Please sign in to comment.