Skip to content

Commit

Permalink
feat(label): Expose variable "regex_replace_chars" to allow changing …
Browse files Browse the repository at this point in the history
…label module behaviour (#34)
  • Loading branch information
k911 authored and aknysh committed Nov 6, 2019
1 parent f522a36 commit 69fd155
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ Available targets:
| namespace | Namespace (e.g. `eg` or `cp`) | string | `` | no |
| principals_full_access | Principal ARNs to provide with full access to the ECR | list(string) | `<list>` | no |
| principals_readonly_access | Principal ARNs to provide with readonly access to the ECR | list(string) | `<list>` | no |
| regex_replace_chars | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`. By default only hyphens, letters and digits are allowed, all other chars are removed | string | `/[^a-zA-Z0-9-]/` | no |
| scan_images_on_push | Indicates whether images are scanned after being pushed to the repository (true) or not (false) | bool | `false` | no |
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | `` | no |
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')`) | map(string) | `<map>` | no |
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
| namespace | Namespace (e.g. `eg` or `cp`) | string | `` | no |
| principals_full_access | Principal ARNs to provide with full access to the ECR | list(string) | `<list>` | no |
| principals_readonly_access | Principal ARNs to provide with readonly access to the ECR | list(string) | `<list>` | no |
| regex_replace_chars | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`. By default only hyphens, letters and digits are allowed, all other chars are removed | string | `/[^a-zA-Z0-9-]/` | no |
| scan_images_on_push | Indicates whether images are scanned after being pushed to the repository (true) or not (false) | bool | `false` | no |
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | `` | no |
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')`) | map(string) | `<map>` | no |
Expand Down
17 changes: 9 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ locals {
}

module "label" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.16.0"
enabled = var.enabled
namespace = var.namespace
stage = var.stage
name = var.name
delimiter = var.delimiter
attributes = var.attributes
tags = var.tags
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.16.0"
enabled = var.enabled
namespace = var.namespace
stage = var.stage
name = var.name
delimiter = var.delimiter
attributes = var.attributes
tags = var.tags
regex_replace_chars = var.regex_replace_chars
}

resource "aws_ecr_repository" "default" {
Expand Down
7 changes: 7 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,10 @@ variable "max_image_count" {
description = "How many Docker Image versions AWS ECR will store"
default = 500
}

variable "regex_replace_chars" {
type = string
default = "/[^a-zA-Z0-9-]/"
description = "Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`. By default only hyphens, letters and digits are allowed, all other chars are removed"
}

0 comments on commit 69fd155

Please sign in to comment.