Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created October 18, 2021 15:22
Show Gist options
  • Select an option

  • Save KyMidd/e55c64810ac59fcfca8cbd387956e5db to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/e55c64810ac59fcfca8cbd387956e5db to your computer and use it in GitHub Desktop.
data "aws_iam_policy_document" "aws_ecr_repository_policy" {
for_each = toset(local.account_ids)
statement {
sid = "KeyVaultPolicyForAccount${each.value}" #Must be unique in policy, so appending account ID
effect = "Allow"
principals {
type = "AWS"
identifiers = ["arn:aws:iam::${each.value}:root"]
}
actions = [
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
"ecr:BatchCheckLayerAvailability",
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment