hi guys i have problem in bashscript aws like this:
#!/bin/bash
for x in $(aws resourcegroupstaggingapi get-resources --resource-type-filters eks --query "ResourceTagMappingList[*].{ResourceARN:ResourceARN}" --output text)
do
for y in $(aws resourcegroupstaggingapi get-resources --resource-type-filters eks --query "ResourceTagMappingList[*].{Project:Tags[?Key=='Name']|[0].Value,Project:Tags[?Key=='Project']|[0].Value}" --output text)
do
echo "$x"" ""$y"
done
done
the output for each aws code if not use FOR is :
value of x if not use for:
$aws resourcegroupstaggingapi get-resources --resource-type-filters eks --query "ResourceTagMappingList[*].{ResourceARN:ResourceARN}" --output text
arn:aws:eks:ap-southeast-1:id:cluster/fetcher
arn:aws:eks:ap-southeast-1:id:cluster/Hotel
value Y if not use for:
$aws resourcegroupstaggingapi get-resources --resource-type-filters eks --query "ResourceTagMappingList[*].{Project:Tags[?Key=='Name']|[0].Value,Project:Tags[?Key=='Project']|[0].Value}" --output text
Extra API
Hotel Booking
but the output from the shell script is:
arn:aws:eks:ap-southeast-1:id:cluster/fetcher Extra
arn:aws:eks:ap-southeast-1:id:cluster/fetcher API
arn:aws:eks:ap-southeast-1:id:cluster/fetcher Hotel
arn:aws:eks:ap-southeast-1:id:cluster/fetcher Booking
arn:aws:eks:ap-southeast-1:id:cluster/Hotel Extra
arn:aws:eks:ap-southeast-1:id:cluster/Hotel API
arn:aws:eks:ap-southeast-1:id:cluster/Hotel Hotel
arn:aws:eks:ap-southeast-1:id:cluster/Hotel Booking
can some one fix this code with the right output like this with spaceline in value y not in new line example:
arn:aws:eks:ap-southeast-1:id:cluster/fetcher Extra API
arn:aws:eks:ap-southeast-1:id:cluster/Hotel Hotel Booking