{"id":28423199,"url":"https://github.com/terraform-aws-modules/terraform-aws-ecr","last_synced_at":"2025-06-14T11:04:26.625Z","repository":{"id":37957036,"uuid":"482252293","full_name":"terraform-aws-modules/terraform-aws-ecr","owner":"terraform-aws-modules","description":"Terraform module to create AWS ECR resources 🇺🇦","archived":false,"fork":false,"pushed_at":"2025-03-30T13:36:00.000Z","size":91,"stargazers_count":60,"open_issues_count":0,"forks_count":115,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-05T08:45:33.833Z","etag":null,"topics":["aws","aws-ecr","ecr","ecr-repositories","terraform","terraform-module"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/modules/terraform-aws-modules/ecr/aws","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terraform-aws-modules.png","metadata":{"funding":{"github":["antonbabenko"],"custom":"https://www.paypal.me/antonbabenko"},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-16T12:47:34.000Z","updated_at":"2025-05-23T04:10:07.000Z","dependencies_parsed_at":"2024-03-04T20:37:37.200Z","dependency_job_id":"d8a64786-bd4a-46ed-8d01-c9098304f2e2","html_url":"https://github.com/terraform-aws-modules/terraform-aws-ecr","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":"clowdhaus/terraform-aws-module-template","purl":"pkg:github/terraform-aws-modules/terraform-aws-ecr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-ecr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-ecr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-ecr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-ecr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terraform-aws-modules","download_url":"https://codeload.github.com/terraform-aws-modules/terraform-aws-ecr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-ecr/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259804841,"owners_count":22913901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-ecr","ecr","ecr-repositories","terraform","terraform-module"],"created_at":"2025-06-05T08:35:52.189Z","updated_at":"2025-06-14T11:04:26.612Z","avatar_url":"https://github.com/terraform-aws-modules.png","language":"HCL","funding_links":["https://github.com/sponsors/antonbabenko","https://www.paypal.me/antonbabenko"],"categories":[],"sub_categories":[],"readme":"# Amazon ECR Terraform module\n\nTerraform module which creates Amazon ECR resources.\n\n## Usage\n\nSee [`examples`](https://github.com/terraform-aws-modules/terraform-aws-ecr/tree/master/examples) directory for working examples to reference:\n\n### Private Repository\n\n```hcl\nmodule \"ecr\" {\n  source = \"terraform-aws-modules/ecr/aws\"\n\n  repository_name = \"private-example\"\n\n  repository_read_write_access_arns = [\"arn:aws:iam::012345678901:role/terraform\"]\n  repository_lifecycle_policy = jsonencode({\n    rules = [\n      {\n        rulePriority = 1,\n        description  = \"Keep last 30 images\",\n        selection = {\n          tagStatus     = \"tagged\",\n          tagPrefixList = [\"v\"],\n          countType     = \"imageCountMoreThan\",\n          countNumber   = 30\n        },\n        action = {\n          type = \"expire\"\n        }\n      }\n    ]\n  })\n\n  tags = {\n    Terraform   = \"true\"\n    Environment = \"dev\"\n  }\n}\n```\n\n### Public Repository\n\n```hcl\nmodule \"public_ecr\" {\n  source = \"terraform-aws-modules/ecr/aws\"\n\n  repository_name = \"public-example\"\n  repository_type = \"public\"\n\n  repository_read_write_access_arns = [\"arn:aws:iam::012345678901:role/terraform\"]\n\n  public_repository_catalog_data = {\n    description       = \"Docker container for some things\"\n    about_text        = file(\"${path.module}/files/ABOUT.md\")\n    usage_text        = file(\"${path.module}/files/USAGE.md\")\n    operating_systems = [\"Linux\"]\n    architectures     = [\"x86\"]\n    logo_image_blob   = filebase64(\"${path.module}/files/clowd.png\")\n  }\n\n  tags = {\n    Terraform   = \"true\"\n    Environment = \"dev\"\n  }\n}\n```\n\n### Registry Management\n\n```hcl\nmodule \"ecr_registry\" {\n  source = \"terraform-aws-modules/ecr/aws\"\n\n  repository_name = \"registry-example\"\n\n  create_repository = false\n\n  # Registry Policy\n  create_registry_policy = true\n  registry_policy        = jsonencode({\n    Version = \"2012-10-17\",\n    Statement = [\n      {\n        Sid    = \"testpolicy\",\n        Effect = \"Allow\",\n        Principal = {\n          \"AWS\" : \"arn:aws:iam::012345678901:root\"\n        },\n        Action = [\n          \"ecr:ReplicateImage\"\n        ],\n        Resource = [\n          \"arn:aws:ecr:us-east-1:012345678901:repository/*\"\n        ]\n      }, {\n        Sid    = \"dockerhub\",\n        Effect = \"Allow\",\n        Principal = {\n          \"AWS\" : \"arn:aws:iam::012345678901:root\"\n        },\n        Action = [\n          \"ecr:CreateRepository\",\n          \"ecr:BatchImportUpstreamImage\"\n        ],\n        Resource = [\n          \"arn:aws:ecr:us-east-1:012345678901:repository/dockerhub/*\"\n        ]\n      }\n    ]\n  })\n\n  # Registry Pull Through Cache Rules\n  registry_pull_through_cache_rules = {\n    pub = {\n      ecr_repository_prefix = \"ecr-public\"\n      upstream_registry_url = \"public.ecr.aws\"\n    }\n    dockerhub = {\n      ecr_repository_prefix = \"dockerhub\"\n      upstream_registry_url = \"registry-1.docker.io\"\n      credential_arn        = \"arn:aws:secretsmanager:us-east-1:123456789:secret:ecr-pullthroughcache/dockerhub\"\n    }\n  }\n\n  # Registry Scanning Configuration\n  manage_registry_scanning_configuration = true\n  registry_scan_type                     = \"ENHANCED\"\n  registry_scan_rules = [\n    {\n      scan_frequency = \"SCAN_ON_PUSH\"\n      filter = [\n        {\n          filter      = \"example1\"\n          filter_type = \"WILDCARD\"\n        },\n        { filter      = \"example2\"\n          filter_type = \"WILDCARD\"\n        }\n      ]\n    }, {\n      scan_frequency = \"CONTINUOUS_SCAN\"\n      filter = [\n        {\n          filter      = \"example\"\n          filter_type = \"WILDCARD\"\n        }\n      ]\n    }\n  ]\n\n  # Registry Replication Configuration\n  create_registry_replication_configuration = true\n  registry_replication_rules = [\n    {\n      destinations = [{\n        region      = \"us-west-2\"\n        registry_id = \"012345678901\"\n        }, {\n        region      = \"eu-west-1\"\n        registry_id = \"012345678901\"\n      }]\n\n      repository_filters = [{\n        filter      = \"prod-microservice\"\n        filter_type = \"PREFIX_MATCH\"\n      }]\n    }\n  ]\n\n  tags = {\n    Terraform   = \"true\"\n    Environment = \"dev\"\n  }\n}\n```\n\n## Module wrappers\n\nUsers of this Terraform module can create multiple similar resources by using [`for_each` meta-argument within `module` block](https://www.terraform.io/language/meta-arguments/for_each) which became available in Terraform 0.13.\n\nUsers of Terragrunt can achieve similar results by using modules provided in the [wrappers](https://github.com/terraform-aws-modules/terraform-aws-ecr/tree/master/wrappers) directory, if they prefer to reduce amount of configuration files.\n\n## Examples\n\nExamples codified under the [`examples`](https://github.com/terraform-aws-modules/terraform-aws-ecr/tree/master/examples) are intended to give users references for how to use the module(s) as well as testing/validating changes to the source code of the module. If contributing to the project, please be sure to make any appropriate updates to the relevant examples to allow maintainers to test your changes and to keep the examples up to date for users. Thank you!\n\n- [Complete](https://github.com/terraform-aws-modules/terraform-aws-ecr/tree/master/examples/complete)\n- [Repository Template](https://github.com/terraform-aws-modules/terraform-aws-ecr/tree/master/examples/repository-template)\n\n\u003c!-- BEGIN_TF_DOCS --\u003e\n## Requirements\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"requirement_terraform\"\u003e\u003c/a\u003e [terraform](#requirement\\_terraform) | \u003e= 1.0 |\n| \u003ca name=\"requirement_aws\"\u003e\u003c/a\u003e [aws](#requirement\\_aws) | \u003e= 5.93 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"provider_aws\"\u003e\u003c/a\u003e [aws](#provider\\_aws) | \u003e= 5.93 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [aws_ecr_lifecycle_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_lifecycle_policy) | resource |\n| [aws_ecr_pull_through_cache_rule.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_pull_through_cache_rule) | resource |\n| [aws_ecr_registry_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_registry_policy) | resource |\n| [aws_ecr_registry_scanning_configuration.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_registry_scanning_configuration) | resource |\n| [aws_ecr_replication_configuration.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_replication_configuration) | resource |\n| [aws_ecr_repository.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_repository) | resource |\n| [aws_ecr_repository_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_repository_policy) | resource |\n| [aws_ecrpublic_repository.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecrpublic_repository) | resource |\n| [aws_ecrpublic_repository_policy.example](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecrpublic_repository_policy) | resource |\n| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |\n| [aws_iam_policy_document.repository](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| \u003ca name=\"input_attach_repository_policy\"\u003e\u003c/a\u003e [attach\\_repository\\_policy](#input\\_attach\\_repository\\_policy) | Determines whether a repository policy will be attached to the repository | `bool` | `true` | no |\n| \u003ca name=\"input_create\"\u003e\u003c/a\u003e [create](#input\\_create) | Determines whether resources will be created (affects all resources) | `bool` | `true` | no |\n| \u003ca name=\"input_create_lifecycle_policy\"\u003e\u003c/a\u003e [create\\_lifecycle\\_policy](#input\\_create\\_lifecycle\\_policy) | Determines whether a lifecycle policy will be created | `bool` | `true` | no |\n| \u003ca name=\"input_create_registry_policy\"\u003e\u003c/a\u003e [create\\_registry\\_policy](#input\\_create\\_registry\\_policy) | Determines whether a registry policy will be created | `bool` | `false` | no |\n| \u003ca name=\"input_create_registry_replication_configuration\"\u003e\u003c/a\u003e [create\\_registry\\_replication\\_configuration](#input\\_create\\_registry\\_replication\\_configuration) | Determines whether a registry replication configuration will be created | `bool` | `false` | no |\n| \u003ca name=\"input_create_repository\"\u003e\u003c/a\u003e [create\\_repository](#input\\_create\\_repository) | Determines whether a repository will be created | `bool` | `true` | no |\n| \u003ca name=\"input_create_repository_policy\"\u003e\u003c/a\u003e [create\\_repository\\_policy](#input\\_create\\_repository\\_policy) | Determines whether a repository policy will be created | `bool` | `true` | no |\n| \u003ca name=\"input_manage_registry_scanning_configuration\"\u003e\u003c/a\u003e [manage\\_registry\\_scanning\\_configuration](#input\\_manage\\_registry\\_scanning\\_configuration) | Determines whether the registry scanning configuration will be managed | `bool` | `false` | no |\n| \u003ca name=\"input_public_repository_catalog_data\"\u003e\u003c/a\u003e [public\\_repository\\_catalog\\_data](#input\\_public\\_repository\\_catalog\\_data) | Catalog data configuration for the repository | `any` | `{}` | no |\n| \u003ca name=\"input_registry_policy\"\u003e\u003c/a\u003e [registry\\_policy](#input\\_registry\\_policy) | The policy document. This is a JSON formatted string | `string` | `null` | no |\n| \u003ca name=\"input_registry_pull_through_cache_rules\"\u003e\u003c/a\u003e [registry\\_pull\\_through\\_cache\\_rules](#input\\_registry\\_pull\\_through\\_cache\\_rules) | List of pull through cache rules to create | `map(map(string))` | `{}` | no |\n| \u003ca name=\"input_registry_replication_rules\"\u003e\u003c/a\u003e [registry\\_replication\\_rules](#input\\_registry\\_replication\\_rules) | The replication rules for a replication configuration. A maximum of 10 are allowed | `any` | `[]` | no |\n| \u003ca name=\"input_registry_scan_rules\"\u003e\u003c/a\u003e [registry\\_scan\\_rules](#input\\_registry\\_scan\\_rules) | One or multiple blocks specifying scanning rules to determine which repository filters are used and at what frequency scanning will occur | `any` | `[]` | no |\n| \u003ca name=\"input_registry_scan_type\"\u003e\u003c/a\u003e [registry\\_scan\\_type](#input\\_registry\\_scan\\_type) | the scanning type to set for the registry. Can be either `ENHANCED` or `BASIC` | `string` | `\"ENHANCED\"` | no |\n| \u003ca name=\"input_repository_encryption_type\"\u003e\u003c/a\u003e [repository\\_encryption\\_type](#input\\_repository\\_encryption\\_type) | The encryption type for the repository. Must be one of: `KMS` or `AES256`. Defaults to `AES256` | `string` | `null` | no |\n| \u003ca name=\"input_repository_force_delete\"\u003e\u003c/a\u003e [repository\\_force\\_delete](#input\\_repository\\_force\\_delete) | If `true`, will delete the repository even if it contains images. Defaults to `false` | `bool` | `null` | no |\n| \u003ca name=\"input_repository_image_scan_on_push\"\u003e\u003c/a\u003e [repository\\_image\\_scan\\_on\\_push](#input\\_repository\\_image\\_scan\\_on\\_push) | Indicates whether images are scanned after being pushed to the repository (`true`) or not scanned (`false`) | `bool` | `true` | no |\n| \u003ca name=\"input_repository_image_tag_mutability\"\u003e\u003c/a\u003e [repository\\_image\\_tag\\_mutability](#input\\_repository\\_image\\_tag\\_mutability) | The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE`. Defaults to `IMMUTABLE` | `string` | `\"IMMUTABLE\"` | no |\n| \u003ca name=\"input_repository_kms_key\"\u003e\u003c/a\u003e [repository\\_kms\\_key](#input\\_repository\\_kms\\_key) | The ARN of the KMS key to use when encryption\\_type is `KMS`. If not specified, uses the default AWS managed key for ECR | `string` | `null` | no |\n| \u003ca name=\"input_repository_lambda_read_access_arns\"\u003e\u003c/a\u003e [repository\\_lambda\\_read\\_access\\_arns](#input\\_repository\\_lambda\\_read\\_access\\_arns) | The ARNs of the Lambda service roles that have read access to the repository | `list(string)` | `[]` | no |\n| \u003ca name=\"input_repository_lifecycle_policy\"\u003e\u003c/a\u003e [repository\\_lifecycle\\_policy](#input\\_repository\\_lifecycle\\_policy) | The policy document. This is a JSON formatted string. See more details about [Policy Parameters](http://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html#lifecycle_policy_parameters) in the official AWS docs | `string` | `\"\"` | no |\n| \u003ca name=\"input_repository_name\"\u003e\u003c/a\u003e [repository\\_name](#input\\_repository\\_name) | The name of the repository | `string` | `\"\"` | no |\n| \u003ca name=\"input_repository_policy\"\u003e\u003c/a\u003e [repository\\_policy](#input\\_repository\\_policy) | The JSON policy to apply to the repository. If not specified, uses the default policy | `string` | `null` | no |\n| \u003ca name=\"input_repository_policy_statements\"\u003e\u003c/a\u003e [repository\\_policy\\_statements](#input\\_repository\\_policy\\_statements) | A map of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for custom permission usage | `any` | `{}` | no |\n| \u003ca name=\"input_repository_read_access_arns\"\u003e\u003c/a\u003e [repository\\_read\\_access\\_arns](#input\\_repository\\_read\\_access\\_arns) | The ARNs of the IAM users/roles that have read access to the repository | `list(string)` | `[]` | no |\n| \u003ca name=\"input_repository_read_write_access_arns\"\u003e\u003c/a\u003e [repository\\_read\\_write\\_access\\_arns](#input\\_repository\\_read\\_write\\_access\\_arns) | The ARNs of the IAM users/roles that have read/write access to the repository | `list(string)` | `[]` | no |\n| \u003ca name=\"input_repository_type\"\u003e\u003c/a\u003e [repository\\_type](#input\\_repository\\_type) | The type of repository to create. Either `public` or `private` | `string` | `\"private\"` | no |\n| \u003ca name=\"input_tags\"\u003e\u003c/a\u003e [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| \u003ca name=\"output_repository_arn\"\u003e\u003c/a\u003e [repository\\_arn](#output\\_repository\\_arn) | Full ARN of the repository |\n| \u003ca name=\"output_repository_name\"\u003e\u003c/a\u003e [repository\\_name](#output\\_repository\\_name) | Name of the repository |\n| \u003ca name=\"output_repository_registry_id\"\u003e\u003c/a\u003e [repository\\_registry\\_id](#output\\_repository\\_registry\\_id) | The registry ID where the repository was created |\n| \u003ca name=\"output_repository_url\"\u003e\u003c/a\u003e [repository\\_url](#output\\_repository\\_url) | The URL of the repository |\n\u003c!-- END_TF_DOCS --\u003e\n\n## License\n\nApache-2.0 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-ecr/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraform-aws-modules%2Fterraform-aws-ecr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterraform-aws-modules%2Fterraform-aws-ecr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraform-aws-modules%2Fterraform-aws-ecr/lists"}