Skip to content

Commit 2c2e625

Browse files
committed
fix: unique secret dicts in tf
1 parent 038c89c commit 2c2e625

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

infra/functions-python/main.tf

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ locals {
8989
# }
9090

9191
locals {
92-
# Step 1: Flatten all secret_environment_variables lists into one
9392
all_secret_dicts = concat(
9493
local.function_tokens_config.secret_environment_variables,
9594
local.function_process_validation_report_config.secret_environment_variables,
@@ -101,13 +100,13 @@ locals {
101100
local.function_tasks_executor_config.secret_environment_variables
102101
)
103102

104-
# Step 2: Create a map with key = secret.key, value = full secret (to deduplicate by key)
105-
unique_secret_dict_map = {
106-
for s in local.all_secret_dicts : s.key => s
107-
}
108-
109-
# Step 3: Convert the map back to a list
110-
unique_secret_dicts = values(local.unique_secret_dict_map)
103+
# Remove duplicates by key, keeping the first occurrence
104+
unique_secret_dicts = [
105+
for i, s in local.all_secret_dicts :
106+
s if index([
107+
for j in local.all_secret_dicts : j.key
108+
], s.key) == i
109+
]
111110
}
112111

113112

0 commit comments

Comments
 (0)