Skip to content

Commit 0b0a113

Browse files
authoredFeb 2, 2023
Merge pull request #17 from DNXLabs/adding_tags
Adding tags
2 parents 748efa8 + 73df820 commit 0b0a113

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed
 

‎README.md

+2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ The following resources will be created:
3434

3535
| Name | Description | Type | Default | Required |
3636
|------|-------------|------|---------|:--------:|
37+
| image\_tag\_mutability | The tag mutability setting for the repository. Must be one of: MUTABLE or IMMUTABLE. Defaults to MUTABLE. | `string` | `"MUTABLE"` | no |
3738
| kms\_key\_arn | KMS Key ARN to use a CMK instead of default key | `string` | n/a | yes |
3839
| name | Name for ECR repository | `any` | n/a | yes |
40+
| tags | Map of tags that will be added to created resources. By default resources will be tagged with name and environment. | `map(string)` | `{}` | no |
3941
| trust\_accounts | Accounts to trust and allow ECR fetch | `list(string)` | n/a | yes |
4042

4143
## Outputs

‎_variables.tf

+12
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,16 @@ variable "trust_accounts" {
1010
variable "kms_key_arn" {
1111
type = string
1212
description = "KMS Key ARN to use a CMK instead of default key"
13+
}
14+
15+
variable "image_tag_mutability" {
16+
type = string
17+
description = "The tag mutability setting for the repository. Must be one of: MUTABLE or IMMUTABLE. Defaults to MUTABLE."
18+
default = "MUTABLE"
19+
}
20+
21+
variable "tags" {
22+
description = "Map of tags that will be added to created resources. By default resources will be tagged with name and environment."
23+
type = map(string)
24+
default = {}
1325
}

‎ecr-repositories.tf

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
resource "aws_ecr_repository" "default" {
2-
name = var.name
2+
name = var.name
3+
image_tag_mutability = var.image_tag_mutability
34

45
encryption_configuration {
56
encryption_type = "KMS"
67
kms_key = length(var.kms_key_arn) > 0 ? var.kms_key_arn : ""
78
}
9+
10+
tags = merge(
11+
var.tags,
12+
{
13+
"Name" = "${var.name}"
14+
},
15+
)
16+
817
}

0 commit comments

Comments
 (0)