Amazon ECR Repositories
Overview
This service contains code to create and manage multiple Amazon Elastic Container Repository (ECR) Repositories that can be used for storing and distributing container images.
ECR architecture
Features
- Create and manage multiple ECR repositories
- Store private Docker images for use in any Docker Orchestration system (e.g., Kubernetes, ECS, etc)
- Share repositories across accounts
- Fine grained access control
- Automatically scan Docker images for security vulnerabilities
Learn
note
This repo is a part of the Gruntwork Service Catalog, a collection of reusable, battle-tested, production ready infrastructure code. If you’ve never used the Service Catalog before, make sure to read How to use the Gruntwork Service Catalog!
- ECR documentation: Amazon’s docs for ECR that cover core concepts such as repository URLs, image scanning, and access control.
Deploy
Non-production deployment (quick start for learning)
If you just want to try this repo out for experimenting and learning, check out the following resources:
- examples/for-learning-and-testing folder: The
examples/for-learning-and-testing
folder contains standalone sample code optimized for learning, experimenting, and testing (but not direct production usage).
Production deployment
If you want to deploy this repo in production, check out the following resources:
- examples/for-production folder: The
examples/for-production
folder contains sample code optimized for direct usage in production. This is code from the Gruntwork Reference Architecture, and it shows you how we build an end-to-end, integrated tech stack on top of the Gruntwork Service Catalog.
Reference
- Inputs
- Outputs
Required
repositories
anyA map of repo names to configurations for that repository.
Any types represent complex values of variable type. For details, please consult `variables.tf` in the source repo.
Optional
Whether or not to enable image scanning on all the repos. Can be overridden on a per repo basis by the enable_automatic_image_scanning property in the repositories map.
true
default_encryption_config
object(…)The default encryption configuration to apply to the created ECR repository. When null, the images in the ECR repo will not be encrypted at rest. Can be overridden on a per repo basis by the encryption_config property in the repositories map.
object({
# The encryption type to use for the repository. Must be AES256 or KMS.
encryption_type = string
# The KMS key to use for encrypting the images. Only used when encryption_type is KMS. If not specified, defaults to
# the default AWS managed key for ECR.
kms_key = string
})
{
encryption_type = "AES256",
kms_key = null
}
default_external_account_ids_with_lambda_access
list(string)The default list of AWS account IDs for external AWS accounts that should be able to create Lambda functions based on container images in these ECR repos. Can be overridden on a per repo basis by the external_account_ids_with_lambda_access property in the repositories map.
[]
default_external_account_ids_with_read_access
list(string)The default list of AWS account IDs for external AWS accounts that should be able to pull images from these ECR repos. Can be overridden on a per repo basis by the external_account_ids_with_read_access property in the repositories map.
[]
default_external_account_ids_with_write_access
list(string)The default list of AWS account IDs for external AWS accounts that should be able to pull and push images to these ECR repos. Can be overridden on a per repo basis by the external_account_ids_with_write_access property in the repositories map.
[]
The tag mutability setting for all the repos. Must be one of: MUTABLE or IMMUTABLE. Can be overridden on a per repo basis by the image_tag_mutability property in the repositories map.
"MUTABLE"
Add lifecycle policy to ECR repo.
Any types represent complex values of variable type. For details, please consult `variables.tf` in the source repo.
[]
global_tags
map(string)A map of tags (where the key and value correspond to tag keys and values) that should be assigned to all ECR repositories.
{}
replication_regions
list(string)List of regions (e.g., us-east-1) to replicate the ECR repository to.
[]
A list of IAM policy actions necessary for ECR read access.
A map of repository name to its ECR ARN.
A map of repository name to its URL.
A list of IAM policy actions necessary for ECR write access.