Skip to content

Commit eb9651e

Browse files
committed
Add tag to edge stack
1 parent 7379db9 commit eb9651e

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

packages/microapps-cdk/src/MicroAppsEdgeToOrigin.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as crypto from 'crypto';
22
import { existsSync, writeFileSync } from 'fs';
33
import * as os from 'os';
44
import * as path from 'path';
5-
import { Aws, Duration, RemovalPolicy, Stack } from 'aws-cdk-lib';
5+
import { Aws, Duration, RemovalPolicy, Stack, Tags } from 'aws-cdk-lib';
66
import * as cf from 'aws-cdk-lib/aws-cloudfront';
77
import * as iam from 'aws-cdk-lib/aws-iam';
88
import * as lambda from 'aws-cdk-lib/aws-lambda';
@@ -292,12 +292,19 @@ replaceHostHeader: ${props.replaceHostHeader}`;
292292

293293
// EdgeFunction has a bug where it will generate the same parameter
294294
// name across multiple stacks in the same region if the id param is constant
295-
return new cf.experimental.EdgeFunction(this, `edge-to-apigwy-func-${this.hashStackName()}`, {
296-
stackId: `microapps-edge-to-origin-${this.hashStackName()}`,
297-
code: lambda.Code.fromAsset(distPath),
298-
functionName: `microapps-edge-to-origin-${this.hashStackName()}`,
299-
handler: 'index.handler',
300-
...edgeToOriginFuncProps,
301-
});
295+
const edge = new cf.experimental.EdgeFunction(
296+
this,
297+
`edge-to-apigwy-func-${this.hashStackName()}`,
298+
{
299+
stackId: `microapps-edge-to-origin-${this.hashStackName()}`,
300+
code: lambda.Code.fromAsset(distPath),
301+
functionName: `microapps-edge-to-origin-${this.hashStackName()}`,
302+
handler: 'index.handler',
303+
...edgeToOriginFuncProps,
304+
},
305+
);
306+
Tags.of(edge).add('Name', Stack.of(this).stackName);
307+
308+
return edge;
302309
}
303310
}

0 commit comments

Comments
 (0)