Skip to content

Commit 7379db9

Browse files
committed
Fix stack tags
1 parent 9ded845 commit 7379db9

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

packages/cdk/lib/MicroAppsBuilder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ export class MicroAppsBuilder extends Stack {
2828

2929
const { shared } = props;
3030

31-
SharedTags.addSharedTags(this);
31+
SharedTags.addSharedTags(Stack.of(this));
3232

3333
// This stack is deployed manually once per env, it's never a temp stack
34-
SharedTags.addEnvTag(this, shared.env, false);
34+
SharedTags.addEnvTag(Stack.of(this), shared.env, false);
3535

3636
const nameRoot = Stack.of(this).stackName;
3737

packages/cdk/lib/SharedTags.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
import { Stack, Tags } from 'aws-cdk-lib';
2-
import { IConstruct } from 'constructs';
3-
import { SharedProps } from './SharedProps';
42
import { Env } from './Types';
53

6-
interface SharedTagsProps {
7-
shared: SharedProps;
8-
}
9-
104
export class SharedTags {
11-
public static addSharedTags(construct: IConstruct): void {
12-
Tags.of(construct).add('repository', 'https://github.com/pwrdrvr/microapps-core/');
13-
Tags.of(construct).add(
5+
public static addSharedTags(stack: Stack): void {
6+
Tags.of(stack).add('repository', 'https://github.com/pwrdrvr/microapps-core/');
7+
Tags.of(stack).add(
148
'application',
159
// Note: this value is excluded from the strict S3 deny rules in microapps-cdk,
16-
// which will allow the TTL deletion lambda in this construct to delete the S3
10+
// which will allow the TTL deletion lambda in this stack to delete the S3
1711
// buckets - if these tags do not match then the delete by the lambda will fail.
18-
`${Stack.of(construct).stackName}`,
12+
`${stack.stackName}`,
1913
);
2014
}
2115

22-
public static addEnvTag(construct: IConstruct, env: Env | '', isEphemeral: boolean): void {
23-
if (env !== '' && env !== undefined) Tags.of(construct).add('environment', env);
16+
public static addEnvTag(stack: Stack, env: Env | '', isEphemeral: boolean): void {
17+
if (env !== '' && env !== undefined) Tags.of(stack).add('environment', env);
2418
if (isEphemeral) {
25-
Tags.of(construct).add('ephemeral', 'true');
19+
Tags.of(stack).add('ephemeral', 'true');
2620
// Note: a dynamic timestamp tag causes all dependency stacks
2721
// to redeploy to update the timestamp tag, which takes forever with
2822
// CloudFront. It may be possible to preserve this in `cdk.context.json`

0 commit comments

Comments
 (0)