This AWS blog post will create an Elastic Container Registry (ECR) with a Terraform configuration code.
AWS, Elastic Container Registry (ECR) allows us to store, push and pull Docker container images while maintaining top security levels. ECR also includes a built-in vulnerability scanning to detect security issues.
Terraform Configuration
The following Terraform configuration code will create a secure ECR registry in AWS with tags. All you need to do is change the name of the registry and set the region of your choice.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "3.47.0"
}
}
}
provider "aws" {
region = "us-east-2"
}
resource "aws_ecr_repository" "ecr" {
name = "deploycontainersecr"
image_tag_mutability = "MUTABLE"
image_scanning_configuration {
scan_on_push = true
}
tags = {
name = "ecr"
}
}