Skip to content

Commit 9c44ee1

Browse files
committed
updates
1 parent 5c6313d commit 9c44ee1

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

examples/tests/components/terraform/test/template-functions-test/outputs.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,21 @@ output "test_label_id" {
22
value = module.test_label.id
33
description = "Test label ID"
44
}
5+
6+
output "test_list" {
7+
value = [
8+
"list_item_1",
9+
"list_item_2",
10+
"list_item_3"
11+
]
12+
description = "Test list"
13+
}
14+
15+
output "test_map" {
16+
value = {
17+
a = 1,
18+
b = 2,
19+
c = 3
20+
}
21+
description = "Test map"
22+
}

internal/exec/template_funcs_component.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,23 @@ func componentFunc(cliConfig schema.CliConfiguration, component string, stack st
8686
y, err2 := u.ConvertToYAML(outputMeta)
8787
if err2 != nil {
8888
u.LogError(err2)
89+
} else {
90+
u.LogTrace(cliConfig, fmt.Sprintf("\nResult of 'atmos terraform output %s -s %s' before processing it:\n%s\n", component, stack, y))
8991
}
90-
u.LogTrace(cliConfig, fmt.Sprintf("\nResult of 'atmos terraform output %s -s %s' before processing it:\n%s\n", component, stack, y))
9192
}
9293

9394
outputMetaProcessed := lo.MapEntries(outputMeta, func(k string, v tfexec.OutputMeta) (string, any) {
9495
s := string(v.Value)
95-
u.LogTrace(cliConfig, fmt.Sprintf("Converting the variable %s from JSON to string representation\n", s))
96+
u.LogTrace(cliConfig, fmt.Sprintf("Converting the variable '%s' with the value\n%s\nfrom JSON to 'Go' data type\n", k, s))
9697

9798
d, err2 := u.ConvertFromJSON(s)
9899

99100
if err2 != nil {
100101
u.LogError(err2)
102+
} else {
103+
u.LogTrace(cliConfig, fmt.Sprintf("Converted the variable '%s' with the value\n%s\nfrom JSON to 'Go' data type\nResult: %v\n", k, s, d))
101104
}
102105

103-
u.LogTrace(cliConfig, fmt.Sprintf("Converted the variable %s from JSON to string representation.\nResult: %s\n", s, d))
104-
105106
return k, d
106107
})
107108

@@ -119,9 +120,9 @@ func componentFunc(cliConfig schema.CliConfiguration, component string, stack st
119120
y, err2 := u.ConvertToYAML(outputMetaProcessed)
120121
if err2 != nil {
121122
u.LogError(err2)
123+
} else {
124+
u.LogTrace(cliConfig, y)
122125
}
123-
u.LogTrace(cliConfig, y)
124-
u.LogTrace(cliConfig, "\n")
125126
}
126127

127128
return sections, nil

0 commit comments

Comments
 (0)