in utils/manifest-utils.ts [49:59]
export function createIAMServiceAccount(scope: cdk.Construct, cluster: eks.ICluster, namespace: string, name: string, policyPath: string): eks.ServiceAccount {
const sa = new eks.ServiceAccount(scope, name + "SA", {
cluster, name, namespace
});
const policyJson = fs.readFileSync(path.resolve(policyPath), "utf8");
((JSON.parse(policyJson))['Statement'] as []).forEach((statement, idx, array) => {
sa.addToPrincipalPolicy(iam.PolicyStatement.fromJson(statement));
});
return sa;
}