Terraform module which creates AWS ECR resources in bulk.
Amazon Elastic Container Registry. Share and deploy container software, publicly or privately
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.
See examples
directory for working examples to reference:
module "blueprint" {
source = "terraform-module/ecr/aws"
version = "~> 1.0"
ecrs = {
api = {
tags = { Service = "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
export ECR_REPO=AWS_ACCOUNT_ID.dkr.ecr.<REGION>.amazonaws.com/repositoryName
aws ecr get-login-password --region <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
See examples
directory for working examples to reference
- Create multiple ECR repositories
- Manages an ECR repository lifecycle policy.
Name | Version |
---|---|
terraform | >= 1 |
Name | Version |
---|---|
aws | n/a |
No modules.
Name | Type |
---|---|
aws_ecr_lifecycle_policy.this | resource |
aws_ecr_repository.this | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
ecrs | Map of ECRs to create. | any |
{} |
no |
tags | A mapping of tags to assign to all resources | map(string) |
{} |
no |
Name | Description |
---|---|
repositories | Provides an Elastic Container Registry Repositories. |
urls | The URL of the repository (in the form aws_account_id.dkr.ecr.region.amazonaws.com/repositoryName). |
- 📝 Use a succinct title and description.
- 🐛 Bugs & feature requests can be be opened
- 📶 Support questions are better asked on Stack Overflow
- 😊 Be nice, civil and polite (as always).
Copyright 2019 Ivan Katliarhcuk
MIT Licensed. See LICENSE for full details.
Submit a pull request
Currently maintained by Ivan Katliarchuk and these awesome contributors.