ECR Repository
๐ฆ Overviewโ
This Terraform module provisions a private Amazon ECR repository in a specified AWS region.
It enables secure, versioned container storage for teams deploying to ECS, EKS, or self-managed platforms.
โ Key Featuresโ
- Creates a secure, private ECR repository
- Supports custom names and standard environment tagging
- Enables use with ECS, EKS, Lambda, or other container runtimes
- Fully managed and integrated into AWS identity and security models
๐ผ Use Casesโ
- Teams storing backend or microservice container images
- CI/CD pipelines pushing and pulling container builds
- Infrastructure teams managing base images for internal tools
- ECS and EKS environments requiring tightly scoped registries
๐ฅ Input Variablesโ
| Name | Type | Description |
|---|---|---|
region | string | AWS region to deploy the ECR repository |
repository_name | string | The name of the container image repository |
environment | string | Tag to specify the deployment environment (e.g., dev, prod) |
๐ค Outputsโ
| Name | Description |
|---|---|
repository_url | The full URL of the created ECR repository |
repository_arn | The ARN of the created ECR repository |
repository_name | The name of the created ECR repository |
๐ Deployment Readinessโ
- โ Compatible with Terraform 1.0+
- โ Tested with AWS provider 5.x
- ๐งช Requires IAM permissions to create and manage ECR resources
๐ ๏ธ Example Usageโ
module "ecr-repository-deployment" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//developer-utilities/ecr-repository?ref=v1.0.0"
region = "us-east-1"
repository_name = "archiphire-backend"
environment = "prod"
}
terraform init
terraform plan
terraform apply
or
tofu init
tofu plan
tofu apply
๐งน Cleanup Optionsโ
For testing:
terraform destroy
or
tofu destroy
For production: Manually delete the repository using the AWS CLI to avoid breaking pipelines or services:
aws ecr delete-repository --repository-name <your_repo_name> --force
๐ก๏ธ Notesโ
This is a Level 1 container infrastructure module for provisioning private ECR repositories. For use cases requiring public access, image scanning, or lifecycle rules, consider extending this with a hardened or policy-enhanced variant.
๐ Deployment Package Noticeโ
This module is part of the Level 1 AWS License Tier. To access the full deployment package and source code, subscribe to Archiphire.