Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 524

Pipe aws output to jq will not result in array [duplicate]

$
0
0

I try to use to get all hosts from an elbv2 LoadBalancer rule to an array to expand the list.I tried to query the existing hosts inside the rule with

TESTOUTPUT=$(aws elbv2 describe-rules --rule-arns arn:aws:elasticloadbalancing:ap-northeast-1:xxxx:listener-rule/app/k8s-ctrlroute-xxx/xxx/xxx --region ap-northeast-1 --no-cli-pager)

works great, I get the JSON with the hosts back. No I try to parse the output direct to an Array with

TESTOUTPUT=$(aws elbv2 describe-rules --rule-arns arn:aws:elasticloadbalancing:ap-northeast-1:xxxx:listener-rule/app/k8s-ctrlroute-xxx/xxx/xxx --region ap-northeast-1 --no-cli-pager | jq [.Rules[0].Conditions[0].Values[]])

The result are the expected hosts. It looks like

[ "host1.cloud", "host2.cloud", "host3.cloud" ]

But if I not try to add an entry with TESTOUTPUT+="host4.cloud" I will get

[ "host1.cloud", "host2.cloud", "host3.cloud" ]host4.cloud

So I assume the expected array is not an array. But the jq output is the syntax for array output.Maybe someone can borrow me two eyes for a different view on the case to find out what is wrong in my code.


Viewing all articles
Browse latest Browse all 524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>