17
17
)
18
18
19
19
func componentFunc (cliConfig schema.CliConfiguration , component string , stack string ) (any , error ) {
20
- u .LogTrace (cliConfig , fmt .Sprintf ("Executing template function atmos.Component(%s, %s)" , component , stack ))
20
+ u .LogTrace (cliConfig , fmt .Sprintf ("Executing template function ' atmos.Component(%s, %s)' " , component , stack ))
21
21
22
22
stackSlug := fmt .Sprintf ("%s-%s" , stack , component )
23
23
@@ -82,9 +82,26 @@ func componentFunc(cliConfig schema.CliConfiguration, component string, stack st
82
82
return nil , err
83
83
}
84
84
85
+ if cliConfig .Logs .Level == u .LogLevelTrace {
86
+ y , err2 := u .ConvertToYAML (outputMeta )
87
+ if err2 != nil {
88
+ u .LogError (err2 )
89
+ }
90
+ u .LogTrace (cliConfig , fmt .Sprintf ("\n Result of 'atmos terraform output %s -s %s' before processing it:\n %s\n " , component , stack , y ))
91
+ }
92
+
85
93
outputMetaProcessed := lo .MapEntries (outputMeta , func (k string , v tfexec.OutputMeta ) (string , any ) {
86
- d , err2 := u .ConvertFromJSON (string (v .Value ))
87
- u .LogError (err2 )
94
+ s := string (v .Value )
95
+ u .LogTrace (cliConfig , fmt .Sprintf ("Converting the variable %s from JSON to string representation\n " , s ))
96
+
97
+ d , err2 := u .ConvertFromJSON (s )
98
+
99
+ if err2 != nil {
100
+ u .LogError (err2 )
101
+ }
102
+
103
+ u .LogTrace (cliConfig , fmt .Sprintf ("Converted the variable %s from JSON to string representation.\n Result: %s\n " , s , d ))
104
+
88
105
return k , d
89
106
})
90
107
@@ -98,11 +115,13 @@ func componentFunc(cliConfig schema.CliConfiguration, component string, stack st
98
115
componentFuncSyncMap .Store (stackSlug , sections )
99
116
100
117
if cliConfig .Logs .Level == u .LogLevelTrace {
101
- u .LogTrace (cliConfig , fmt .Sprintf ("Executed template function atmos.Component(%s, %s)\n 'outputs' section:\n " , component , stack ))
102
- err2 := u .PrintAsYAML (outputMetaProcessed )
118
+ u .LogTrace (cliConfig , fmt .Sprintf ("Executed template function ' atmos.Component(%s, %s)' \n \n 'outputs' section:" , component , stack ))
119
+ y , err2 := u .ConvertToYAML (outputMetaProcessed )
103
120
if err2 != nil {
104
121
u .LogError (err2 )
105
122
}
123
+ u .LogTrace (cliConfig , y )
124
+ u .LogTrace (cliConfig , "\n " )
106
125
}
107
126
108
127
return sections , nil
0 commit comments