File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -338,8 +338,9 @@ module "public_ecr_github_actions_upload_credentials_notebook_service" {
338338}
339339
340340module "obi_notebook_image" {
341- source = " ./private-ecr-repo"
342- repository_name = " obi-notebook-image"
341+ source = " ./private-ecr-repo"
342+ repository_name = " obi-notebook-image"
343+ allowed_to_pull_identities = [" arn:aws:iam::992382665735:role/eksctl-jupyterhub-svc-nodegroup-ng-NodeInstanceRole-ZT1FeO9Ce2wc" ]
343344}
344345
345346module "private_ecr_github_actions_upload_credentials_obi-notebook_image" {
Original file line number Diff line number Diff line change 1+ data "aws_iam_policy_document" "allow_eks_pull_from_ecr" {
2+ statement {
3+ sid = " AllowEKSCrossAccountPullfromECR-${ var . repository_name } "
4+ effect = " Allow"
5+
6+ principals {
7+ type = " AWS"
8+ identifiers = var. allowed_to_pull_identities
9+ }
10+
11+ actions = [
12+ " ecr:BatchCheckLayerAvailability" ,
13+ " ecr:BatchGetImage" ,
14+ " ecr:GetDownloadUrlForLayer"
15+ ]
16+ }
17+ }
18+
19+ resource "aws_ecr_repository_policy" "allow_eks_pull_from_ecr" {
20+ repository = aws_ecr_repository. private_repo . name
21+ policy = data. aws_iam_policy_document . allow_eks_pull_from_ecr . json
22+ }
Original file line number Diff line number Diff line change @@ -3,3 +3,8 @@ variable "repository_name" {
33 description = " Name of the repository"
44 sensitive = false
55}
6+
7+ variable "allowed_to_pull_identities" {
8+ type = list (any )
9+ description = " List of AWS identities that are allow to pull from the private repository"
10+ }
You can’t perform that action at this time.
0 commit comments