File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,9 @@ No modules.
24
24
25
25
The following resources are used by this module:
26
26
27
- - [ aws_ecr_lifecycle_policy.ecr_lifecycle_policy ] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_lifecycle_policy ) (resource)
28
- - [ aws_ecr_repository.ecr_repo ] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_repository ) (resource)
29
- - [ aws_iam_policy_document.ecr_policy ] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document ) (data source)
27
+ - [ aws_ecr_lifecycle_policy.this ] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_lifecycle_policy ) (resource)
28
+ - [ aws_ecr_repository.this ] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_repository ) (resource)
29
+ - [ aws_iam_policy_document.this ] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document ) (data source)
30
30
31
31
## Required Inputs
32
32
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ provider "aws" {
2
2
region = var. region
3
3
}
4
4
5
- resource "aws_ecr_repository" "ecr_repo " {
5
+ resource "aws_ecr_repository" "this " {
6
6
name = var. name
7
7
image_tag_mutability = " MUTABLE"
8
8
@@ -11,8 +11,8 @@ resource "aws_ecr_repository" "ecr_repo" {
11
11
}
12
12
}
13
13
14
- resource "aws_ecr_lifecycle_policy" "ecr_lifecycle_policy " {
15
- repository = aws_ecr_repository. ecr_repo . name
14
+ resource "aws_ecr_lifecycle_policy" "this " {
15
+ repository = aws_ecr_repository. this . name
16
16
17
17
policy = << EOF
18
18
{
35
35
}
36
36
37
37
// Create aws ecr repository that allows a list of arns to push and pull from it
38
- data "aws_iam_policy_document" "ecr_policy " {
38
+ data "aws_iam_policy_document" "this " {
39
39
statement {
40
+ sid = " AllowPushPull"
40
41
actions = [
41
42
" ecr:BatchCheckLayerAvailability" ,
42
43
" ecr:BatchGetImage" ,
@@ -51,8 +52,10 @@ data "aws_iam_policy_document" "ecr_policy" {
51
52
type = " AWS"
52
53
}
53
54
effect = " Allow"
54
- resources = [
55
- aws_ecr_repository . ecr_repo . arn
56
- ]
57
55
}
58
56
}
57
+
58
+ resource "aws_ecr_repository_policy" "this" {
59
+ repository = aws_ecr_repository. this . name
60
+ policy = data. aws_iam_policy_document . this . json
61
+ }
You can’t perform that action at this time.
0 commit comments