So I am trying to learn how to use Alloy for the first time. One of the situations I am trying to figure out is, I have a date file (JSON) that I want to read some values from and be able to use that in my configuration.
For example, there are maybe half a dozen values that I’d essentially like to include as extra_labels
for the loki_write
component.
I did create a component for the local file just fine, and I can use the json_decode
to get the data. But all I can figure out is:
external_labels = {
platform = json_decode(local.file.app_info.content).platform,
cluster = json_decode(local.file.app_info.content).cluster,
environment = json_decode(local.file.app_info.content).environment,
}
Is that really the way to do it? Or is there some better way to do the decoding and then leverage the map elsewhere in my config?