-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpusher.tf
More file actions
41 lines (35 loc) · 1 KB
/
pusher.tf
File metadata and controls
41 lines (35 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
resource "aws_iam_user" "image_pusher" {
name = "image-pusher-${local.resource_name}"
tags = data.ns_workspace.this.tags
}
resource "aws_iam_access_key" "image_pusher" {
user = aws_iam_user.image_pusher.name
}
// The actions listed are necessary to perform actions to push ECR images
resource "aws_iam_user_policy" "image_pusher" {
name = "AllowECRPush"
user = aws_iam_user.image_pusher.name
policy = data.aws_iam_policy_document.image_pusher.json
}
data "aws_iam_policy_document" "image_pusher" {
statement {
sid = "AllowPushPull"
effect = "Allow"
actions = [
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
"ecr:BatchCheckLayerAvailability",
"ecr:PutImage",
"ecr:InitiateLayerUpload",
"ecr:UploadLayerPart",
"ecr:CompleteLayerUpload"
]
resources = aws_ecr_repository.this.*.arn
}
statement {
sid = "AllowAuthorization"
effect = "Allow"
actions = ["ecr:GetAuthorizationToken"]
resources = ["*"]
}
}