Skip to content

Commit fc95b54

Browse files
committed
refactor: Add 'repo_mapping' variable, useful if you don't want to use a YAML file
1 parent dfdea2a commit fc95b54

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ graph LR
6363
|------|-------------|------|---------|:--------:|
6464
| <a name="input_app_name"></a> [app\_name](#input\_app\_name) | Name used for resources to create. | `string` | `"flux2-ecr-webhook"` | no |
6565
| <a name="input_cw_logs_retention"></a> [cw\_logs\_retention](#input\_cw\_logs\_retention) | Specifies the number of days you want to retain log events in the specified log group. | `number` | `14` | no |
66-
| <a name="input_repo_mapping"></a> [repo\_mapping](#input\_repo\_mapping) | Object with repository mapping. | `any` | `null` | no |
66+
| <a name="input_repo_mapping"></a> [repo\_mapping](#input\_repo\_mapping) | Object with repository mapping, if this variable is set `repo_mapping_file` will be ignored. | `any` | `null` | no |
6767
| <a name="input_repo_mapping_file"></a> [repo\_mapping\_file](#input\_repo\_mapping\_file) | YAML file path with repository mapping. | `string` | `""` | no |
6868
| <a name="input_webhook_token"></a> [webhook\_token](#input\_webhook\_token) | Webhook token used to call the Flux receiver. | `string` | `null` | no |
6969

locals.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
locals {
2-
repo_mapping = yamldecode(file(var.repo_mapping_file))
2+
repo_mapping = var.repo_mapping == null ? yamldecode(file(var.repo_mapping_file)) : var.repo_mapping
33
}

variables.tf

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ variable "app_name" {
77
variable "repo_mapping_file" {
88
description = "YAML file path with repository mapping."
99
type = string
10+
default = ""
11+
}
12+
13+
variable "repo_mapping" {
14+
description = "Object with repository mapping, if this variable is set `repo_mapping_file` will be ignored."
15+
type = any
16+
default = null
1017
}
1118

1219
variable "webhook_token" {

0 commit comments

Comments
 (0)