Provides an Elastic Container Registry Repository.
resource "aws_ecr_repository" "foo" {
name = "bar"
image_tag_mutability = "MUTABLE"
image_scanning_configuration {
scan_on_push = true
}
}
This resource supports the following arguments:
name
- (Required) Name of the repository.encryption_configuration
- (Optional) Encryption configuration for the repository. See below for schema.force_delete
- (Optional) If true
, will delete the repository even if it contains images.
Defaults to false
.image_tag_mutability
- (Optional) The tag mutability setting for the repository. Must be one of: MUTABLE
or IMMUTABLE
. Defaults to MUTABLE
.image_scanning_configuration
- (Optional) Configuration block that defines image scanning configuration for the repository. By default, image scanning must be manually triggered. See the ECR User Guide for more information about image scanning.
scan_on_push
- (Required) Indicates whether images are scanned after being pushed to the repository (true) or not scanned (false).tags
- (Optional) A map of tags to assign to the resource. If configured with a provider default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.encryption_type
- (Optional) The encryption type to use for the repository. Valid values are AES256
or KMS
. Defaults to AES256
.kms_key
- (Optional) The ARN of the KMS key to use when encryption_type
is KMS
. If not specified, uses the default AWS managed key for ECR.This resource exports the following attributes in addition to the arguments above:
arn
- Full ARN of the repository.registry_id
- The registry ID where the repository was created.repository_url
- The URL of the repository (in the form aws_account_id.dkr.ecr.region.amazonaws.com/repositoryName
).tags_all
- A map of tags assigned to the resource, including those inherited from the provider default_tags
configuration block.delete
- (Default 20m
)In Terraform v1.5.0 and later, use an import
block to import ECR Repositories using the name
. For example:
import {
to = aws_ecr_repository.service
id = "test-service"
}
Using terraform import
, import ECR Repositories using the name
. For example:
% terraform import aws_ecr_repository.service test-service