You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, complex JSON is flattened into an outputs map. It would be nice to also a way to easily get nested JSON values at the top level. I propose adding a new output value called get to do this (potentially deprecating the output attribute). For example, in the following JSON
The ClusterName attribute could be read with the following expression: shell_script.test.get["default_tags.ClusterName"].asString
the get object has the following attributes. It will try to cast a value into as many fields as possible. If it cannot set a field, it will use nil, or perhaps the default no-value if nil does not work.
get = {
asString = string
asNumber = number
asBool = bool
asList = list(string)
asMap = map(string)
}
To get a value from a List you could do: tonumber(shell_script.test.get["azure_attributes"].asList[1])
Alternatively you can /refer to individual elements with the [] accessor. For example:
shell_script.test.get["azure_attributes.[1]"]asNumber returns the number 17
The text was updated successfully, but these errors were encountered:
Hello, I am writing many of my resources/data sources using this shell provider. Thanks!
I got into this issue today, and I'm glad to see this issue is created here.
Currently, complex JSON is flattened into an outputs map. It would be nice to also a way to easily get nested JSON values at the top level. I propose adding a new output value called
get
to do this (potentially deprecating theoutput
attribute). For example, in the following JSONThe
ClusterName
attribute could be read with the following expression:shell_script.test.get["default_tags.ClusterName"].asString
the
get
object has the following attributes. It will try to cast a value into as many fields as possible. If it cannot set a field, it will usenil
, or perhaps the default no-value ifnil
does not work.To get a value from a List you could do:
tonumber(shell_script.test.get["azure_attributes"].asList[1])
Alternatively you can /refer to individual elements with the [] accessor. For example:
shell_script.test.get["azure_attributes.[1]"]asNumber
returns the number 17The text was updated successfully, but these errors were encountered: