Skip to content

Commit 12d1a65

Browse files
authored
feat: Expose ecr tag & scan variables in docker-build module (#189)
1 parent 185858d commit 12d1a65

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

modules/docker-build/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ No modules.
7171
| <a name="input_create_ecr_repo"></a> [create\_ecr\_repo](#input\_create\_ecr\_repo) | Controls whether ECR repository for Lambda image should be created | `bool` | `false` | no |
7272
| <a name="input_docker_file_path"></a> [docker\_file\_path](#input\_docker\_file\_path) | Path to Dockerfile in source package | `string` | `"Dockerfile"` | no |
7373
| <a name="input_ecr_repo"></a> [ecr\_repo](#input\_ecr\_repo) | Name of ECR repository to use or to create | `string` | `null` | no |
74+
| <a name="input_ecr_repo_tags"></a> [ecr\_repo\_tags](#input\_ecr\_repo\_tags) | A map of tags to assign to ECR repository | `map(string)` | `{}` | no |
7475
| <a name="input_image_tag"></a> [image\_tag](#input\_image\_tag) | Image tag to use. If not specified current timestamp in format 'YYYYMMDDhhmmss' will be used. This can lead to unnecessary rebuilds. | `string` | `null` | no |
76+
| <a name="input_image_tag_mutability"></a> [image\_tag\_mutability](#input\_image\_tag\_mutability) | The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE` | `string` | `"MUTABLE"` | no |
77+
| <a name="input_scan_on_push"></a> [scan\_on\_push](#input\_scan\_on\_push) | Indicates whether images are scanned after being pushed to the repository | `bool` | `false` | no |
7578
| <a name="input_source_path"></a> [source\_path](#input\_source\_path) | Path to folder containing application code | `string` | `null` | no |
7679

7780
## Outputs

modules/docker-build/main.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,12 @@ resource "docker_registry_image" "this" {
3131
resource "aws_ecr_repository" "this" {
3232
count = var.create_ecr_repo ? 1 : 0
3333

34-
name = var.ecr_repo
34+
name = var.ecr_repo
35+
image_tag_mutability = var.image_tag_mutability
36+
37+
image_scanning_configuration {
38+
scan_on_push = var.scan_on_push
39+
}
40+
41+
tags = var.ecr_repo_tags
3542
}

modules/docker-build/variables.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,22 @@ variable "docker_file_path" {
2727
type = string
2828
default = "Dockerfile"
2929
}
30+
31+
32+
variable "image_tag_mutability" {
33+
description = "The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE`"
34+
type = string
35+
default = "MUTABLE"
36+
}
37+
38+
variable "scan_on_push" {
39+
description = "Indicates whether images are scanned after being pushed to the repository"
40+
type = bool
41+
default = false
42+
}
43+
44+
variable "ecr_repo_tags" {
45+
description = "A map of tags to assign to ECR repository"
46+
type = map(string)
47+
default = {}
48+
}

0 commit comments

Comments
 (0)