I am trying to get a list of all GCP projects on the domain and the project owners and export it to a CSV, I have written a script which provide me details of projectid, name, projectnumber date and time. But not able to fetch - projectowner, folderpath, cost centre, environment.
#!/bin/bash
> project_data.csv
gcloud projects list --format="value(project_id, name, project_number, project_owner, tags, labels.org, createTime.date(tz=LOCAL))" >whole_project_details.txt
echo project_id, project_name, project_number, project_owner, project_tag, project_label, project_time >project_data.csv
while read project_details
do
project_id=`echo $project_details | awk '{print $1}'`
project_name=`echo $project_details | awk '{print $2}'`
project_number=`echo $project_details | awk '{print $3}'`
project_time=`echo $project_details | awk '{print $4}'`
project_owner=`echo $project_details | awk '{print $5}'`
project_label=`echo $project_details | awk '{print $6}'`
project_tag=`echo $project_details | awk '{print $7}'`
echo $project_id, $project_name, $project_number, $project_owner, $project_tag, $project_label, $project_time >> project_data.csv
done < whole_project_details.txt
Please help me, how can fetch that data. As i'm new in GCP platform.