Git Product home page Git Product logo

terraform-aws-ecr's Introduction

AWS ECR Module

AWS ECR Module which creates

  • KMS Key encryption
  • ECR lifecycle
  • ECR policy

Usage

Private Repository

module "ecr" {
    source  = "mattyait/ecr/aws"
    version = "1.0.0"

    image_names = [
        "test",
        "test1",
    ]

    scan_on_push         = true
    image_tag_mutability = "IMMUTABLE"

    max_untagged_image_count = 5
    max_tagged_image_count   = 50
    protected_tags      = ["latest"]

    tags = {
        Environment = "demo"
        Created_By  = "Terraform"
    }
}

Public Repository

module "public_ecr" {
  source          = "../"
  repository_type = "public"
  image_names = [
    "test",
    "test1",
  ]

  public_repository_catalog_data = [
    {
      description       = "Docker container Description test repo"
      about_text        = "About Text test"
      usage_text        = "Usage Text test"
      operating_systems = ["Linux"]
      architectures     = ["x86"]
    },
    {
      description       = "Docker container Description test1 repo"
      about_text        = "About Text test1"
      usage_text        = "Usage Text test1"
      operating_systems = ["Alpine"]
      architectures     = ["x86"]
    }
  ]

  tags = {
    Environment = "demo"
    Created_By  = "Terraform"
  }
}

Requirements

Name Version
terraform >=1.0.3
aws >= 5.31.0

Providers

Name Version
aws >= 5.31.0

Modules

No modules.

Resources

Name Type
aws_ecr_lifecycle_policy.this resource
aws_ecr_repository.this resource
aws_ecr_repository_policy.this resource
aws_ecrpublic_repository.this resource
aws_kms_alias.kms_key_alias resource
aws_kms_key.kms_key resource
aws_caller_identity.current data source
aws_iam_policy_document.only_pull data source
aws_iam_policy_document.push_and_pull data source

Inputs

Name Description Type Default Required
encryption_type The encryption type to use for the repository. Valid values are AES256 or KMS string "AES256" no
image_names List of Docker local image names, used as repository names for AWS ECR list(string) [] no
image_tag_mutability Whether images are allowed to overwrite existing tags. string "MUTABLE" no
kms_key The ARN of the KMS key to use when encryption_type is KMS. If not specified when encryption_type is KMS, uses a new KMS key. Otherwise, uses the default AWS managed key for ECR. string null no
max_tagged_image_count The maximum number of tagged images that you want to retain in repository. number 30 no
max_untagged_image_count The maximum number of untagged images that you want to retain in repository. number 1 no
only_pull_accounts AWS accounts which pull only. list(string) [] no
protected_tags Name of image tags prefixes that should not be destroyed. list(string)
[
"latest"
]
no
public_repository_catalog_data Catalog data configuration for the public repository any {} no
push_and_pull_accounts AWS accounts which push and pull. list(string) [] no
repository_type The type of repository to create(public or private) string "private" no
scan_on_push Whether images should automatically be scanned on push or not. bool false no
tags The tags for the resources map(any) {} no

Outputs

Name Description
ecr_repository_arn Full ARN of the repository
ecr_repository_name Name of first repository created
ecr_repository_registry_id The registry ID where the repository was created.
ecr_repository_url URL of first repository created
repository_arn_map Map of repository names to repository ARNs
repository_url_map Map of repository names to repository URLs

terraform-aws-ecr's People

Contributors

github-actions[bot] avatar mattyait avatar mattyappreciate avatar semantic-release-bot avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.