Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/hazelops/terraform-aws-ecr

Terraform ECR Repo
https://github.com/hazelops/terraform-aws-ecr

Last synced: 19 days ago
JSON representation

Terraform ECR Repo

Awesome Lists containing this project

README

        

# Terraform ECR Module
[![Terraform Tests](https://github.com/hazelops/terraform-aws-ecr/actions/workflows/linter.yml/badge.svg)](https://github.com/hazelops/terraform-aws-ecr/actions/workflows/linter.yml)

Terraform module that creates ECR resources on AWS.

## Description

Provision [ECR Repository](https://docs.aws.amazon.com/AmazonECR/latest/userguide/Repositories.html),
[Repository Policy](https://docs.aws.amazon.com/AmazonECR/latest/userguide/RepositoryPolicies.html) and
[Lifecycle Policy](https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html).

This module provides settings:

- Enable access by ARN
- Automation of cleaning up unused images

## Usage

### Minimal setup & Unrestricted access to ECR

```hcl
module "ecr" {
source = "hazelops/ecr/aws"
version = "~> 2.0"
name = "test"
}
```

## Requirements

No requirements.

## Providers

| Name | Version |
|------|---------|
| [aws](#provider\_aws) | n/a |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_ecr_lifecycle_policy.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_lifecycle_policy) | resource |
| [aws_ecr_repository.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_repository) | resource |
| [aws_ecr_repository_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_repository_policy) | resource |
| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [ecr\_policy](#input\_ecr\_policy) | Optional ECR policy to be applied. | `list(string)` | `[]` | no |
| [enabled](#input\_enabled) | If not enabled, no resources will be created. | `bool` | `true` | no |
| [encryption\_type](#input\_encryption\_type) | The encryption type for the repository. Must be one of: `KMS` or `AES256`. Defaults to `AES256.` | `string` | `null` | no |
| [force\_delete](#input\_force\_delete) | If true, will delete the repository even if it contains images. | `bool` | `false` | no |
| [image\_scan\_on\_push](#input\_image\_scan\_on\_push) | Indicates whether images are scanned after being pushed to the repository (`true`) or not scanned (`false`). | `bool` | `false` | no |
| [image\_tag\_mutability](#input\_image\_tag\_mutability) | The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE`. Defaults to `MUTABLE`. | `string` | `"MUTABLE"` | no |
| [kms\_key](#input\_kms\_key) | The ARN of the KMS key to use when encryption\_type is `KMS`. If not specified, uses the default AWS managed key for ECR. | `string` | `null` | no |
| [max\_any\_image\_count](#input\_max\_any\_image\_count) | Maximum number of images that you want to retain in repository. | `number` | `100` | no |
| [name](#input\_name) | Name of the ECR repository. | `any` | n/a | yes |
| [pull\_arns](#input\_pull\_arns) | List of IAM ARNs that can pull images. | `list(string)` | `[]` | no |
| [push\_arns](#input\_push\_arns) | List of IAM ARNs that can push and pull images and tags. | `list(string)` | `[]` | no |
| [tags](#input\_tags) | A map of tags to add to all resources. | `map(string)` | `{}` | no |

## Outputs

| Name | Description |
|------|-------------|
| [repository\_id](#output\_repository\_id) | n/a |
| [repository\_url](#output\_repository\_url) | n/a |

### Terraform Module Registry

![Hazelops logo](https://avatars0.githubusercontent.com/u/63737915?s=25&v=4) [Terraform ECR Repo
](https://registry.terraform.io/modules/hazelops/ecr/aws)

Inspired by modules from [justinm](https://registry.terraform.io/modules/justinm) and [tmknom](https://registry.terraform.io/modules/tmknom)

Maintainer: [Dmitry Borisov](https://github.com/kobrikx)