Skip to content

Commit f974c7d

Browse files
authored
feat: adds ability to list principals of Lambdas allowed to access ECR (#680)
1 parent d89f5e3 commit f974c7d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

modules/ecr/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ components:
6969
7070
| Name | Source | Version |
7171
|------|--------|---------|
72-
| <a name="module_ecr"></a> [ecr](#module\_ecr) | cloudposse/ecr/aws | 0.35.0 |
72+
| <a name="module_ecr"></a> [ecr](#module\_ecr) | cloudposse/ecr/aws | 0.36.0 |
7373
| <a name="module_full_access"></a> [full\_access](#module\_full\_access) | ../account-map/modules/roles-to-principals | n/a |
7474
| <a name="module_iam_roles"></a> [iam\_roles](#module\_iam\_roles) | ../account-map/modules/iam-roles | n/a |
7575
| <a name="module_readonly_access"></a> [readonly\_access](#module\_readonly\_access) | ../account-map/modules/roles-to-principals | n/a |
@@ -109,6 +109,7 @@ components:
109109
| <a name="input_max_image_count"></a> [max\_image\_count](#input\_max\_image\_count) | Max number of images to store. Old ones will be deleted to make room for new ones. | `number` | n/a | yes |
110110
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br>This is the only ID element not also included as a `tag`.<br>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
111111
| <a name="input_namespace"></a> [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
112+
| <a name="input_principals_lambda"></a> [principals\_lambda](#input\_principals\_lambda) | Principal account IDs of Lambdas allowed to consume ECR | `list(string)` | `[]` | no |
112113
| <a name="input_protected_tags"></a> [protected\_tags](#input\_protected\_tags) | Tags to refrain from deleting | `list(string)` | `[]` | no |
113114
| <a name="input_read_only_account_role_map"></a> [read\_only\_account\_role\_map](#input\_read\_only\_account\_role\_map) | Map of `account:[role, role...]` for read-only access. Use `*` for role to grant access to entire account | `map(list(string))` | `{}` | no |
114115
| <a name="input_read_write_account_role_map"></a> [read\_write\_account\_role\_map](#input\_read\_write\_account\_role\_map) | Map of `account:[role, role...]` for write access. Use `*` for role to grant access to entire account | `map(list(string))` | n/a | yes |

modules/ecr/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ locals {
2020

2121
module "ecr" {
2222
source = "cloudposse/ecr/aws"
23-
version = "0.35.0"
23+
version = "0.36.0"
2424

2525
protected_tags = var.protected_tags
2626
enable_lifecycle_policy = var.enable_lifecycle_policy
@@ -29,6 +29,7 @@ module "ecr" {
2929
max_image_count = var.max_image_count
3030
principals_full_access = compact(concat(module.full_access.principals, [local.ecr_user_arn]))
3131
principals_readonly_access = module.readonly_access.principals
32+
principals_lambda = var.principals_lambda
3233
scan_images_on_push = var.scan_images_on_push
3334
use_fullname = false
3435

modules/ecr/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,9 @@ variable "enable_lifecycle_policy" {
5252
type = bool
5353
description = "Enable/disable image lifecycle policy"
5454
}
55+
56+
variable "principals_lambda" {
57+
type = list(string)
58+
description = "Principal account IDs of Lambdas allowed to consume ECR"
59+
default = []
60+
}

0 commit comments

Comments
 (0)