in terraform-modules/cloud-functions/src/provide-secrets-permissions/main.py [0:0]
def fetch_sa_from_file(bucket_name, blob_name):
"""Function to fetch the Service Accounts written in the text GCS object.
Args:
bucket_name (string): GCS bucket name.
blob_name (string): Object containing the service accounts.
Returns:
sa_list (list); list containing service accounts
"""
from google.cloud import storage
storage_client = storage.Client()
bucket = storage_client.bucket(bucket_name)
blob = bucket.blob(blob_name)
sa_list = []
with blob.open("r") as f:
sa_list.extend(f.read().split())
return(sa_list)