Terraform module to create N number of Elastic Container Registries with custom lifecycle rules. - repo managed by sudoblark.terraform.github
The below documentation is intended to assist a developer with interacting with the Terraform module in order to add, remove or update functionality.
- terraform_docs
brew install terraform_docs
- tfenv
git clone https://github.com/tfutils/tfenv.git ~/.tfenv
echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bash_profile
- Virtual environment with pre-commit installed
python3 -m venv venv
source venv/bin/activate
pip install pre-commit
This repository utilises pre-commit in order to ensure a base level of quality on every commit. The hooks may be installed as follows:
source venv/bin/activate
pip install pre-commit
pre-commit install
pre-commit run --all-files
The below documentation is intended to assist users in utilising the module, the main thing to note is the data structure section which outlines the interface by which users are expected to interact with the module itself, and the examples section which has examples of how to utilise the module.
Name | Version |
---|---|
terraform | ~> 1.5.0 |
aws | >= 5.61.0 |
Name | Version |
---|---|
aws | 5.67.0 |
Name | Source | Version |
---|---|---|
ecr | terraform-aws-modules/ecr/aws | ~> 2.2 |
Name | Type |
---|---|
aws_caller_identity.current_account | data source |
aws_iam_policy_document.registry_policy | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
application_name | Name of the application utilising resource. | string |
n/a | yes |
environment | Which environment this is being instantiated in. | string |
n/a | yes |
raw_ecr_registries | Data structure --------------- A list of dictionaries, where each dictionary has the following attributes: REQUIRED --------- - suffix : Suffix to be added to registry name OPTIONAL --------- - lifecycle_rules : A list of dictionaries, where each dictionary is a rule with the following attributes: Note: See which map on to https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html#lifecycle_policy_parameters for more information on what is and isn't permissible -- rulePriority : int priority, lowest wins, must be a positive integer. -- description : OPTIONAL description of the policy, defaults to null -- tagStatus : OPTIONAL, determines whether the lifecycle policy rule that you are adding specifies a tag for an image Defaults to any -- tagPatternList : OPTIONAL, specify tag patterns to expire rather than wildcarding. -- tagPrefixList : OPTIONAL, specify tag patterns to expire, rather than wildcarding. -- countType : Specify a count type to apply to the images. -- countUnit : Specify a count unit of days to indicate that as the unit of time, in addition to countNumber, which is the number of days. -- countNumber : Specify a count number. Acceptable values are positive integers (0 is not an accepted value). -- action : Only permissible value is expire |
list( |
n/a | yes |
No outputs.
Data structure
---------------
A list of dictionaries, where each dictionary has the following attributes:
REQUIRED
---------
- suffix : Suffix to be added to registry name
OPTIONAL
---------
- lifecycle_rules : A list of dictionaries, where each dictionary is a rule with the following
attributes:
Note: See which map on to https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html#lifecycle_policy_parameters
for more information on what is and isn't permissible
-- rulePriority : int priority, lowest wins, must be a positive integer.
-- description : OPTIONAL description of the policy, defaults to null
-- tagStatus : OPTIONAL, determines whether the lifecycle policy rule that you are adding specifies a tag for an image
Defaults to any
-- tagPatternList : OPTIONAL, specify tag patterns to expire rather than wildcarding.
-- tagPrefixList : OPTIONAL, specify tag patterns to expire, rather than wildcarding.
-- countType : Specify a count type to apply to the images.
-- countUnit : Specify a count unit of days to indicate that as the unit of time, in addition to countNumber, which is the number of days.
-- countNumber : Specify a count number. Acceptable values are positive integers (0 is not an accepted value).
-- action : Only permissible value is expire
See examples
folder for an example setup.