Skip to content

Commit

Permalink
feat: Expose ecr tag & scan variables in docker-build module (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
codezninja authored Aug 14, 2021
1 parent 185858d commit 12d1a65
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
3 changes: 3 additions & 0 deletions modules/docker-build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ No modules.
| <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 |
| <a name="input_docker_file_path"></a> [docker\_file\_path](#input\_docker\_file\_path) | Path to Dockerfile in source package | `string` | `"Dockerfile"` | no |
| <a name="input_ecr_repo"></a> [ecr\_repo](#input\_ecr\_repo) | Name of ECR repository to use or to create | `string` | `null` | no |
| <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 |
| <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 |
| <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 |
| <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 |
| <a name="input_source_path"></a> [source\_path](#input\_source\_path) | Path to folder containing application code | `string` | `null` | no |

## Outputs
Expand Down
9 changes: 8 additions & 1 deletion modules/docker-build/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,12 @@ resource "docker_registry_image" "this" {
resource "aws_ecr_repository" "this" {
count = var.create_ecr_repo ? 1 : 0

name = var.ecr_repo
name = var.ecr_repo
image_tag_mutability = var.image_tag_mutability

image_scanning_configuration {
scan_on_push = var.scan_on_push
}

tags = var.ecr_repo_tags
}
19 changes: 19 additions & 0 deletions modules/docker-build/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,22 @@ variable "docker_file_path" {
type = string
default = "Dockerfile"
}


variable "image_tag_mutability" {
description = "The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE`"
type = string
default = "MUTABLE"
}

variable "scan_on_push" {
description = "Indicates whether images are scanned after being pushed to the repository"
type = bool
default = false
}

variable "ecr_repo_tags" {
description = "A map of tags to assign to ECR repository"
type = map(string)
default = {}
}

0 comments on commit 12d1a65

Please sign in to comment.