Skip to content

Commit 1cec5ed

Browse files
committed
naming
1 parent e875c30 commit 1cec5ed

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

ab-testing/cdk/bin/deployment-lambda.cdk.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import "source-map-support/register.js";
22
import { GuRoot } from "@guardian/cdk/lib/constructs/root.js";
3-
import { DeploymentLambda } from "../lib/deploymentLambda.ts";
3+
import { AbTestingDeploymentLambda } from "../lib/deploymentLambda.ts";
44

55
const app = new GuRoot({ outdir: "cdk.out/deployment-lambda" });
66

7-
new DeploymentLambda(app, "AbTestingDeploymentLambdaCode", {
7+
new AbTestingDeploymentLambda(app, "AbTestingDeploymentLambdaCode", {
88
stack: "frontend",
99
stage: "CODE",
1010
env: {
1111
region: "eu-west-1",
1212
},
1313
});
1414

15-
new DeploymentLambda(app, "AbTestingDeploymentLambdaProd", {
15+
new AbTestingDeploymentLambda(app, "AbTestingDeploymentLambdaProd", {
1616
stack: "frontend",
1717
stage: "PROD",
1818
env: {

ab-testing/cdk/lib/abTestingConfig.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { GuStack } from "@guardian/cdk/lib/constructs/core/stack.js";
33
import type { App } from "aws-cdk-lib";
44
import { CustomResource, Duration } from "aws-cdk-lib";
55
import { Function } from "aws-cdk-lib/aws-lambda";
6+
import { lambdaFunctionName } from "./deploymentLambda.ts";
67

78
export class AbTestingConfig extends GuStack {
89
constructor(scope: App, id: string, props: GuStackProps) {
@@ -11,7 +12,7 @@ export class AbTestingConfig extends GuStack {
1112
const lambda = Function.fromFunctionName(
1213
this,
1314
"DeploymentLambdaFunction",
14-
`${props.app}-${this.stage}`,
15+
`${lambdaFunctionName}-${this.stage}`,
1516
);
1617

1718
// Trigger the Lambda to run upon deployment

ab-testing/cdk/lib/deploymentLambda.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import type { App } from "aws-cdk-lib";
66
import { Runtime } from "aws-cdk-lib/aws-lambda";
77
import { StringParameter } from "aws-cdk-lib/aws-ssm";
88

9-
export class DeploymentLambda extends GuStack {
9+
export const lambdaFunctionName = "ab-testing-deployment-lambda";
10+
11+
export class AbTestingDeploymentLambda extends GuStack {
1012
constructor(scope: App, id: string, props: GuStackProps) {
1113
super(scope, id, props);
1214

@@ -38,10 +40,10 @@ export class DeploymentLambda extends GuStack {
3840
);
3941

4042
const lambda = new GuLambdaFunction(this, "AbTestingDeploymentLambda", {
41-
functionName: `ab-testing-deployment-${this.stage}`,
43+
functionName: `${lambdaFunctionName}-${this.stage}`,
4244
fileName: "lambda.zip",
4345
handler: "index.handler",
44-
app: "ab-testing-deployment-lambda",
46+
app: `${lambdaFunctionName}-lambda`,
4547
runtime: Runtime.NODEJS_22_X,
4648
memorySize: 256,
4749
environment: {

0 commit comments

Comments
 (0)