From 82eb0833a3b3b07483a5d275ac64899a268a8483 Mon Sep 17 00:00:00 2001 From: Adam Hall Date: Tue, 16 Jul 2024 11:07:55 +0930 Subject: [PATCH 1/4] HOTFIX: Allow multiple stacks to be deployed to the same acocunt with safer defaults Only create auth table if name is passed Add prop to pass dashboard name Set default dashboard name to include the stack name so that a second stack with no prop set won't cause a failed deployment --- packages/graphql-mesh-server/lib/fargate.ts | 7 ++++--- packages/graphql-mesh-server/lib/metrics.ts | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/graphql-mesh-server/lib/fargate.ts b/packages/graphql-mesh-server/lib/fargate.ts index db4733d2..2eaa025d 100644 --- a/packages/graphql-mesh-server/lib/fargate.ts +++ b/packages/graphql-mesh-server/lib/fargate.ts @@ -149,8 +149,9 @@ export interface MeshServiceProps { */ logStreamPrefix?: string; /** - * Whether a DynamoDB table should be created to store session data - * @default authentication-table + * Whether a DynamoDB table should be created to store session data, + * if not defined a table will not be created. + * @default undefined */ authenticationTable?: string; @@ -348,7 +349,7 @@ export class MeshService extends Construct { managedPolicyArn: "arn:aws:iam::aws:policy/AWSXRayDaemonWriteAccess", }); - if (props.authenticationTable || props.authenticationTable === undefined) { + if (props.authenticationTable) { const authTable = new dynamodb.Table(this, "authenticationTable", { tableName: props.authenticationTable || "authentication-table", partitionKey: { diff --git a/packages/graphql-mesh-server/lib/metrics.ts b/packages/graphql-mesh-server/lib/metrics.ts index 83fd967a..408e1718 100644 --- a/packages/graphql-mesh-server/lib/metrics.ts +++ b/packages/graphql-mesh-server/lib/metrics.ts @@ -30,6 +30,7 @@ export interface PerformanceMetricsProps { logGroup: LogGroup; snsTopic?: Topic; additionalAlarms?: Alarm[]; + dashboardName?: string; } export class PerformanceMetrics extends Construct { @@ -355,7 +356,7 @@ export class PerformanceMetrics extends Construct { // Create the dashboard new Dashboard(this, "dashboard", { - dashboardName: "Mesh-Dashboard", + dashboardName: props.dashboardName ?? Stack.of(this).stackName + "-Mesh-Dashboard", widgets: [ [new Column(...loadBalancerWidgets), new Column(...wafWidgets)], [meshPerformanceLabel], From 5c5a162660cb536c013e5a352860ad180e75c6a1 Mon Sep 17 00:00:00 2001 From: Adam Hall Date: Tue, 16 Jul 2024 11:11:06 +0930 Subject: [PATCH 2/4] Formatting fixes --- packages/graphql-mesh-server/lib/metrics.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/graphql-mesh-server/lib/metrics.ts b/packages/graphql-mesh-server/lib/metrics.ts index 408e1718..b89e6a1a 100644 --- a/packages/graphql-mesh-server/lib/metrics.ts +++ b/packages/graphql-mesh-server/lib/metrics.ts @@ -356,7 +356,8 @@ export class PerformanceMetrics extends Construct { // Create the dashboard new Dashboard(this, "dashboard", { - dashboardName: props.dashboardName ?? Stack.of(this).stackName + "-Mesh-Dashboard", + dashboardName: + props.dashboardName ?? Stack.of(this).stackName + "-Mesh-Dashboard", widgets: [ [new Column(...loadBalancerWidgets), new Column(...wafWidgets)], [meshPerformanceLabel], From 6fcaf99d588c19bf3f8a83ed0d4cee3cdc9fb8ef Mon Sep 17 00:00:00 2001 From: Adam Hall Date: Tue, 16 Jul 2024 11:14:18 +0930 Subject: [PATCH 3/4] Add passthrough prop --- packages/graphql-mesh-server/lib/graphql-mesh-server.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/graphql-mesh-server/lib/graphql-mesh-server.ts b/packages/graphql-mesh-server/lib/graphql-mesh-server.ts index eed38c66..fe9733c3 100644 --- a/packages/graphql-mesh-server/lib/graphql-mesh-server.ts +++ b/packages/graphql-mesh-server/lib/graphql-mesh-server.ts @@ -219,6 +219,13 @@ export type MeshHostingProps = { * @default - AWS generated task definition family name */ taskDefinitionFamilyName?: string; + + /** + * Specify a name for the dashboard + * + * @default - {stackName}-Mesh-Dashboard + */ + dashboardName?: string; }; export class MeshHosting extends Construct { From 92262b577db95e816b6cb9fc8de56f20d5546e7c Mon Sep 17 00:00:00 2001 From: Adam Hall Date: Tue, 16 Jul 2024 13:11:54 +0930 Subject: [PATCH 4/4] CR Changes: Default to undefined for an autogenerated AWS name --- packages/graphql-mesh-server/lib/graphql-mesh-server.ts | 2 +- packages/graphql-mesh-server/lib/metrics.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/graphql-mesh-server/lib/graphql-mesh-server.ts b/packages/graphql-mesh-server/lib/graphql-mesh-server.ts index fe9733c3..0205e64a 100644 --- a/packages/graphql-mesh-server/lib/graphql-mesh-server.ts +++ b/packages/graphql-mesh-server/lib/graphql-mesh-server.ts @@ -223,7 +223,7 @@ export type MeshHostingProps = { /** * Specify a name for the dashboard * - * @default - {stackName}-Mesh-Dashboard + * @default - AWS Generated name */ dashboardName?: string; }; diff --git a/packages/graphql-mesh-server/lib/metrics.ts b/packages/graphql-mesh-server/lib/metrics.ts index b89e6a1a..bed81aa1 100644 --- a/packages/graphql-mesh-server/lib/metrics.ts +++ b/packages/graphql-mesh-server/lib/metrics.ts @@ -356,8 +356,7 @@ export class PerformanceMetrics extends Construct { // Create the dashboard new Dashboard(this, "dashboard", { - dashboardName: - props.dashboardName ?? Stack.of(this).stackName + "-Mesh-Dashboard", + dashboardName: props.dashboardName, widgets: [ [new Column(...loadBalancerWidgets), new Column(...wafWidgets)], [meshPerformanceLabel],