Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
Call readFileSync() method directly in IaC
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Rodriguez committed Oct 25, 2023
1 parent c134e50 commit 8933517
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions iam/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getCluster } from "@pulumi/aws/eks";
import { readFileSync } from "fs";

export function createPolicy(file: string, policyName: string) {
const policy = readFile(file);
const policy = readFileSync(file, "utf8");
return new iam.Policy(policyName, {
policy: policy,
});
Expand All @@ -15,7 +15,7 @@ export function createRole(
accountId: string,
clusterId: string,
) {
const placeholderRole = readFile(file);
const placeholderRole = readFileSync(file, "utf8");

const partiallyUpdatedRole = placeholderRole.replace(
new RegExp("{{AWS_ACCOUNT_ID}}", "g"),
Expand Down Expand Up @@ -71,7 +71,3 @@ export async function getAccountId(): Promise<string> {
const callerId = await getCallerIdentity({});
return callerId.accountId;
}

export function readFile(filename: string): string {
return readFileSync(filename, "utf8");
}

0 comments on commit 8933517

Please sign in to comment.