This module manages AWS Lambda which creates private ECR repositories
whenever an attempt to push to a non-existing repository is logged in
CloudTrail. Since docker push
attempt five times, the repository will
be created before all retry attempts exhausted, if lambda is working
correctly 😉.
For example:
module "lambda" {
source = "tradeparadigm/ecr-repo-lambda/aws"
managed_repo_prefixes = [
"backend/",
"frontend/"
]
}
Name | Version |
---|---|
terraform | >= 1.1 |
archive | >= 2.2 |
aws | >= 4.22 |
Name | Version |
---|---|
archive | >= 2.2 |
aws | >= 4.22 |
Name | Type |
---|---|
aws_cloudwatch_event_rule.this | resource |
aws_cloudwatch_event_target.this | resource |
aws_cloudwatch_log_group.this | resource |
aws_iam_role.this | resource |
aws_iam_role_policy.this | resource |
aws_lambda_function.this | resource |
aws_lambda_function_event_invoke_config.this | resource |
aws_lambda_permission.this | resource |
archive_file.this | data source |
aws_caller_identity.current | data source |
aws_iam_policy_document.access | data source |
aws_iam_policy_document.assume | data source |
aws_region.current | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
image_tag_mutability | ECR repo image tag mutability setting set on every repo Lambda creates. One of MUTABLE or IMMUTABLE . |
string |
"MUTABLE" |
no |
lambda_concurrency | AWS Lambda concurrency reservation. | number |
1 |
no |
log_retention_days | Number of days to retain AWS Lambda logs. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653, and 0. If you select 0, the events in the log group are always retained and never expire. | number |
14 |
no |
managed_repo_prefixes | List of managed ECR repo prefixes Lambda can create repos for. | list(string) |
[] |
no |
name | AWS Lambda name. Region will be appended as suffix: <name>-<aws_region> . |
string |
"create-ecr-repo" |
no |
repo_lifecycle_policy | ECR repository lifecycle policy added to every repo Lambda creates. | string |
"{\n \"rules\": [\n {\n \"rulePriority\": 10,\n \"description\": \"Only keep 20 most recent untagged images.\",\n \"selection\": {\n \"tagStatus\": \"untagged\",\n \"countType\": \"imageCountMoreThan\",\n \"countNumber\": 20\n },\n \"action\": {\n \"type\": \"expire\"\n }\n }\n ]\n}\n" |
no |
repo_policy | ECR repository policy added to every repo Lambda creates. | string |
null |
no |
repo_scan_on_push | Toggles Scan on push on repos Lambda creates. | bool |
true |
no |
repo_tags | ECR repo tags added to every repo Lambda creates. | map(string) |
{} |
no |
tags | Tags to apply to created AWS resources. | map(string) |
{} |
no |
Name | Description |
---|---|
arn | The Lambda ARN. |
invoke_arn | The Lambda API Gateway invoke ARN. |
This file is generated with terraform-docs:
terraform-docs .