Created
April 25, 2020 16:17
-
-
Save DerPauli/bbdd7eb437b77e94cc07a8b08435665e to your computer and use it in GitHub Desktop.
IAM ECR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_iam_access_key" "iam-key-ecr-deploy" { | |
user = aws_iam_user.iam-ecr-deploy.name | |
pgp_key = var.iam_pgp_ecr_deploy | |
} | |
resource "aws_iam_user" "iam-ecr-deploy" { | |
name = var.iam_user_name_ecr_auth | |
} | |
resource "aws_iam_user_policy" "iam-policy-ecr-deploy" { | |
name = var.iam_policy_ecr_deploy_name | |
user = aws_iam_user.iam-ecr-deploy.name | |
policy = <<EOF | |
{ | |
"Version":"2012-10-17", | |
"Statement":[ | |
{ | |
"Sid":"ListImagesInRepository", | |
"Effect":"Allow", | |
"Action":[ | |
"ecr:ListImages" | |
], | |
"Resource":"${var.ecr_auth_ms.arn}" | |
}, | |
{ | |
"Sid":"GetAuthorizationToken", | |
"Effect":"Allow", | |
"Action":[ | |
"ecr:GetAuthorizationToken" | |
], | |
"Resource":"*" | |
}, | |
{ | |
"Sid":"ManageRepositoryContents", | |
"Effect":"Allow", | |
"Action":[ | |
"ecr:GetAuthorizationToken", | |
"ecr:BatchCheckLayerAvailability", | |
"ecr:GetDownloadUrlForLayer", | |
"ecr:GetRepositoryPolicy", | |
"ecr:DescribeRepositories", | |
"ecr:ListImages", | |
"ecr:DescribeImages", | |
"ecr:BatchGetImage", | |
"ecr:InitiateLayerUpload", | |
"ecr:UploadLayerPart", | |
"ecr:CompleteLayerUpload", | |
"ecr:PutImage" | |
], | |
"Resource":"${var.ecr_auth_ms.arn}" | |
} | |
] | |
} | |
EOF | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment