Skip to content

Commit

Permalink
feat: add default for read only role name
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOrangePuff committed Sep 18, 2023
1 parent 41d18f2 commit 40aa7df
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/graphql-mesh-server/lib/fargate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ManagedRule, Scope, WebApplicationFirewall } from './web-application-fi

export interface MeshServiceProps {
/**
* Name of the read only role used to access logs
* Name of the read only role used to access logs (default: graphql-mesh-read-only-role)
*/
readOnlyRoleName?: string;
/**
Expand Down Expand Up @@ -236,11 +236,12 @@ export class MeshService extends Construct {

// Cross account role to get read only access to mesh
// and the relevant logs
if (props.readOnlyRoleName) {
if (props.awsAccountArn) {
const readOnlyRoleName = props.readOnlyRoleName || 'graphql-mesh-read-only-role';
const readOnlyRole = new iam.Role(this, "read-only-role", {
assumedBy: new iam.AccountPrincipal(props.awsAccountArn),
description: "Read Only Role for Mesh Developers",
roleName: props.readOnlyRoleName,
roleName: readOnlyRoleName,
});

const readOnlyPolicy = new iam.ManagedPolicy(this, "read-only-policy");
Expand Down

0 comments on commit 40aa7df

Please sign in to comment.