Skip to content

rabiloo/terraform-aws-ecr

Repository files navigation

AWS ECR Terraform module

Terraform module which creates ECR repository resources on AWS.

Usage

module "php" {
  source  = "rabiloo/ecr/aws"
  version = "~> 0.3.0"

  name                 = "app-name/php"
  image_tag_mutability = "MUTABLE"
  encryption_type      = "AES256"

  protected_tags                 = ["v", "latest"]
  max_image_count                = 20
  untagged_image_expiration_days = 1

  tags = {
    Owner       = "user"
    Service     = "app-name"
  }
}

Requirements

Name Version
terraform ~> 1.2
aws >= 4.52.0

Providers

Name Version
aws 5.37.0

Modules

No modules.

Resources

Name Type
aws_ecr_lifecycle_policy.this resource
aws_ecr_repository.this resource
aws_ecr_repository_policy.policy resource
aws_iam_policy_document.combined data source
aws_iam_policy_document.full data source
aws_iam_policy_document.readonly data source

Inputs

Name Description Type Default Required
name The unique image name string n/a yes
create_ecr_lifecycle_policy n/a bool true no
encryption_type The encryption type for the repository. Must be one of: AES256 or KMS string "AES256" no
full_access_principals Principal ARNs to provide with full access to the ECR list(string) [] no
image_tag_mutability The tag mutability setting for the repository. Must be one of: MUTABLE or IMMUTABLE string "IMMUTABLE" no
kms_key The KMS key to use for encryption. Only used if encryption_type is set to KMS string "" no
max_image_count The maximum number of images to keep in the repository number 20 no
protected_tags The list of tags to protect from deletion list(string) [] no
readonly_access_principals Principal ARNs to provide with readonly access to the ECR list(string) [] no
scan_on_push Whether to scan the repository on push. Must be one of: true or false bool false no
tags A map of tags to add to ECR repository resource map(string) {} no
untagged_image_expiration_days The number of days to keep untagged images in the repository number 1 no

Outputs

Name Description
ecr_repository_arn The ECR repository ARN
ecr_repository_url The ECR repository URL

Development

  1. Install terrform, tflint, terraform-docs and make
  2. Using make
make help

Contributing

All code contributions must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.

Fork the project, create a feature branch, and send a pull request.

If you would like to help take a look at the list of issues.

License

This project is released under the MIT License.
Copyright © 2023 Rabiloo Co., Ltd
Please see License File for more information.