Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/geekcell/terraform-aws-ecr-repository

Terraform module to provision an Amazon Elastic Container Registry.
https://github.com/geekcell/terraform-aws-ecr-repository

aws ecr ecr-registry elastic-container-registry terraform terraform-module

Last synced: 2 days ago
JSON representation

Terraform module to provision an Amazon Elastic Container Registry.

Awesome Lists containing this project

README

        

[![Geek Cell GmbH](https://raw.githubusercontent.com/geekcell/.github/main/geekcell-github-banner.png)](https://www.geekcell.io/)

### Code Quality
[![License](https://img.shields.io/github/license/geekcell/terraform-aws-ecr-repository)](https://github.com/geekcell/terraform-aws-ecr-repository/blob/master/LICENSE)
[![GitHub release (latest tag)](https://img.shields.io/github/v/release/geekcell/terraform-aws-ecr-repository?logo=github&sort=semver)](https://github.com/geekcell/terraform-aws-ecr-repository/releases)
[![Release](https://github.com/geekcell/terraform-aws-ecr-repository/actions/workflows/release.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-ecr-repository/actions/workflows/release.yaml)
[![Validate](https://github.com/geekcell/terraform-aws-ecr-repository/actions/workflows/validate.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-ecr-repository/actions/workflows/validate.yaml)
[![Lint](https://github.com/geekcell/terraform-aws-ecr-repository/actions/workflows/linter.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-ecr-repository/actions/workflows/linter.yaml)
[![Test](https://github.com/geekcell/terraform-aws-ecr-repository/actions/workflows/test.yaml/badge.svg?branch=main)](https://github.com/geekcell/terraform-aws-ecr-repository/actions/workflows/test.yaml)

### Security
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/general)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=INFRASTRUCTURE+SECURITY)

#### Cloud
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/cis_aws)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=CIS+AWS+V1.2)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/cis_aws_13)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=CIS+AWS+V1.3)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/cis_azure)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=CIS+AZURE+V1.1)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/cis_azure_13)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=CIS+AZURE+V1.3)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/cis_gcp)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=CIS+GCP+V1.1)

##### Container
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/cis_kubernetes_16)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=CIS+KUBERNETES+V1.6)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/cis_eks_11)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=CIS+EKS+V1.1)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/cis_gke_11)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=CIS+GKE+V1.1)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/cis_kubernetes)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=CIS+KUBERNETES+V1.5)

#### Data protection
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/soc2)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=SOC2)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/pci)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=PCI-DSS+V3.2)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/pci_dss_v321)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=PCI-DSS+V3.2.1)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/iso)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=ISO27001)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/nist)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=NIST-800-53)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/hipaa)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=HIPAA)
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-ecr-repository/fedramp_moderate)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-ecr-repository&benchmark=FEDRAMP+%28MODERATE%29)

# Terraform AWS ECR Repository

Are you looking for an efficient way to manage your Docker images in AWS? Look no further! Our team has extensive
experience working with AWS ECS and has optimized this Terraform module for AWS Elastic Container Registry (ECR)
that includes a lifecycle policy.

This module makes it easy to set up and manage your ECR repositories, as well as automatically delete images that
are older than 30 days, saving you storage space and reducing your costs. The lifecycle policy ensures that your
repositories are clean and up-to-date, freeing up resources and improving the performance of your application.

Our team has optimized this Terraform module to provide a seamless experience for users. Whether you are just
getting started with containers or looking to enhance your current setup, this module provides a preconfigured
solution for efficiently managing your ECS Cluster with enabled Container Insights, logging, and advanced monitoring.

With this Terraform module, you can quickly set up and manage your ECR repositories, and take advantage of the
benefits of a lifecycle policy, all with just a few simple commands. Try it out today!

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [encryption\_type](#input\_encryption\_type) | The encryption type to use for the repository. | `string` | `"AES256"` | no |
| [force\_delete](#input\_force\_delete) | Delete the repository even if it contains images. | `bool` | `false` | no |
| [image\_tag\_mutability](#input\_image\_tag\_mutability) | The tag mutability setting for the repository. | `string` | `"MUTABLE"` | no |
| [kms\_key](#input\_kms\_key) | The ARN of the KMS key to use for encryption. | `string` | `null` | no |
| [lifecycle\_rules](#input\_lifecycle\_rules) | Lifecycle policy rules for expiring images. |

list(object({
description = optional(string)
tag_status = optional(string)
tag_prefix_list = optional(list(string))
count_type = string
count_unit = optional(string)
count_number = number
}))
|
[
{
"count_number": 30,
"count_type": "imageCountMoreThan",
"description": "Keep the last 30 tagged images",
"tag_prefix_list": [
"sha"
],
"tag_status": "tagged"
},
{
"count_number": 10,
"count_type": "sinceImagePushed",
"count_unit": "days",
"description": "Expire untagged images older than 10 days",
"tag_status": "untagged"
}
]
| no |
| [name](#input\_name) | Name of the ECR repository. | `string` | n/a | yes |
| [policy](#input\_policy) | Repository policy document in JSON format. | `string` | `null` | no |
| [scan\_on\_push](#input\_scan\_on\_push) | Indicates whether images are scanned after being pushed to the repository. | `bool` | `true` | no |
| [tags](#input\_tags) | Tags to add to the ECR repository. | `map(any)` | `{}` | no |

## Outputs

| Name | Description |
|------|-------------|
| [arn](#output\_arn) | The ARN of the repository. |
| [name](#output\_name) | The name of the repository. |
| [url](#output\_url) | The URL of the repository (in the form aws\_account\_id.dkr.ecr.region.amazonaws.com/repositoryName). |

## Providers

| Name | Version |
|------|---------|
| [aws](#provider\_aws) | >= 4.36 |
| [jq](#provider\_jq) | 0.2.1 |

## Resources

- resource.aws_ecr_lifecycle_policy.main (main.tf#43)
- resource.aws_ecr_repository.main (main.tf#19)
- resource.aws_ecr_repository_policy.main (main.tf#36)
- data source.jq_query.main (main.tf#52)

# Examples
### Full
```hcl
module "basic_example" {
source = "../.."

name = var.name
}
```