https://github.com/terraform-module/terraform-aws-ecr
ℹ️ Terraform module which creates AWS ECR resources.
https://github.com/terraform-module/terraform-aws-ecr
aws ecr ivank terraform terraform-module
Last synced: 2 months ago
JSON representation
ℹ️ Terraform module which creates AWS ECR resources.
- Host: GitHub
- URL: https://github.com/terraform-module/terraform-aws-ecr
- Owner: terraform-module
- License: mit
- Created: 2022-05-02T07:00:34.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-06-11T04:34:26.000Z (about 1 year ago)
- Last Synced: 2026-04-11T16:09:31.605Z (3 months ago)
- Topics: aws, ecr, ivank, terraform, terraform-module
- Language: HCL
- Homepage: https://ivankatliarchuk.github.io
- Size: 97.7 KB
- Stars: 4
- Watchers: 0
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AWS ECR(s) Terraform module
Terraform module which creates AWS ECR resources in bulk.
> Amazon Elastic Container Registry. Share and deploy container software, publicly or privately
---



[](https://github.com/terraform-aws-modules/terraform-aws-ecr)




[](https://github.com/terraform-aws-modules/terraform-aws-ecr)
[](https://github.com/terraform-aws-modules/terraform-aws-ecr)




[](https://GitHub.com/terraform-aws-modules/terraform-aws-ecr/graphs/commit-activity)
[](https://github.com/terraform-aws-modules/terraform-aws-ecr)
---
## Documentation
- [TFLint Rules](https://github.com/terraform-linters/tflint/tree/master/docs/rules)
## Usage example
IMPORTANT: The master branch is used in source just as an example. In your code, do not pin to master because there may be breaking changes between releases. Instead pin to the release tag (e.g. ?ref=tags/x.y.z) of one of our [latest releases](https://github.com/terraform-aws-modules/terraform-aws-ecr/releases).
See `examples` directory for working examples to reference:
```hcl
module "blueprint" {
source = "terraform-module/ecr/aws"
version = "~> 1.0"
ecrs = {
api = {
tags = { application-name = "api" }
lifecycle_policy = {
rules = [{
rulePriority = 1
description = "keep last 50 images"
action = {
type = "expire"
}
selection = {
tagStatus = "any"
countType = "imageCountMoreThan"
countNumber = 50
}
}]
}
}
}
}
```
Push docker image to repository
```sh
export ECR_REPO=AWS_ACCOUNT_ID.dkr.ecr..amazonaws.com/repositoryName
aws ecr get-login-password --region | docker login --username AWS --password-stdin $ECR_REPO
docker pull cloudkats/hello-world-rest:latest
docker tag cloudkats/hello-world-rest:latest $ECR_REPO/api:latest
docker push $ECR_REPO/api:latest
```
## Examples
See `examples` directory for working examples to reference
- [Examples Dir](https://github.com/terraform-module/module-blueprint/tree/master/examples/)
## Assumptions
## Available features
- Create multiple ECR repositories
- Manages an ECR repository lifecycle policy.
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1 |
## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | n/a |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [aws_ecr_lifecycle_policy.this](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 |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [ecrs](#input\_ecrs) | Map of ECRs to create. | `any` | `{}` | no |
| [tags](#input\_tags) | A mapping of tags to assign to all resources | `map(string)` | `{}` | no |
## Outputs
| Name | Description |
|------|-------------|
| [repositories](#output\_repositories) | Provides an Elastic Container Registry Repositories. |
| [urls](#output\_urls) | The URL of the repository (in the form aws\_account\_id.dkr.ecr.region.amazonaws.com/repositoryName). |
### :memo: Guidelines
- :memo: Use a succinct title and description.
- :bug: Bugs & feature requests can be be opened
- :signal_strength: Support questions are better asked on [Stack Overflow](https://stackoverflow.com/)
- :blush: Be nice, civil and polite ([as always](http://contributor-covenant.org/version/1/4/)).
## License
Copyright 2019 Ivan Katliarhcuk
MIT Licensed. See [LICENSE](./LICENSE) for full details.
## How to Contribute
Submit a pull request
# Authors
Currently maintained by [Ivan Katliarchuk](https://github.com/ivankatliarchuk) and these [awesome contributors](https://github.com/terraform-aws-modules/terraform-aws-ecr/graphs/contributors).
[](https://GitHub.com/)
## Terraform Registry
- [Module](https://registry.terraform.io/modules/terraform-module/ecrs/aws)
## Resources
- [Terraform modules](https://registry.terraform.io/namespaces/terraform-module)