Skip to content

Commit

Permalink
Merge pull request #1373 from alphagov/add-pull-from-ecr-policy
Browse files Browse the repository at this point in the history
Fix pull_from_ecr policy attachment for nodes
  • Loading branch information
theseanything authored Jul 8, 2024
2 parents f536f33 + 9d5f3b7 commit 1081dc9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion terraform/deployments/cluster-infrastructure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,16 @@ resource "aws_iam_policy" "pull_from_ecr" {
policy = data.aws_iam_policy_document.pull_from_ecr.json
}

resource "aws_iam_role_policy_attachment" "pull_from_ecr" {
policy_arn = aws_iam_policy.pull_from_ecr.arn
role = aws_iam_role.node.name
}

resource "aws_iam_role_policy_attachment" "node" {
for_each = toset([
"AmazonEKSWorkerNodePolicy",
"AmazonEKS_CNI_Policy",
"AmazonSSMManagedInstanceCore",
aws_iam_policy.pull_from_ecr.name,
])
policy_arn = "arn:aws:iam::aws:policy/${each.key}"
role = aws_iam_role.node.name
Expand Down

0 comments on commit 1081dc9

Please sign in to comment.