Skip to content

Commit e493469

Browse files
committed
Default tags to empty array
1 parent 7c776fa commit e493469

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

  • packages/cdk-blue-green-container-deployment/src/lambdas

packages/cdk-blue-green-container-deployment/src/lambdas/ecs-deployment-group/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const getProperties = (
4949
autoRollbackOnEvents: props.AutoRollbackOnEvents,
5050
deploymentConfigName: props.DeploymentConfigName,
5151
arnForDeploymentGroup: props.ArnForDeploymentGroup,
52-
tags: props.Tags,
52+
tags: props.Tags ?? [],
5353
});
5454

5555
export const handleCreate: OnCreateHandler = async (event): Promise<ResourceHandlerReturn> => {
@@ -157,8 +157,8 @@ export const handleUpdate: OnUpdateHandler = async (event): Promise<ResourceHand
157157
})
158158
.promise();
159159

160-
const newTagKeys: string[] = (newProps.tags || []).map((t: any) => t.Key);
161-
const removableTagKeys: string[] = (oldProps.tags || []).map((t: any) => t.Key).filter((t) => !newTagKeys.includes(t));
160+
const newTagKeys: string[] = newProps.tags.map((t: any) => t.Key);
161+
const removableTagKeys: string[] = oldProps.tags.map((t: any) => t.Key).filter((t) => !newTagKeys.includes(t));
162162

163163
if (removableTagKeys.length > 0) {
164164
await codeDeploy

packages/cdk-blue-green-container-deployment/src/lambdas/ecs-service/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const getProperties = (props: CloudFormationCustomResourceEvent['ResourcePropert
5151
healthCheckGracePeriodSeconds: props.HealthCheckGracePeriodSeconds,
5252
deploymentConfiguration: props.DeploymentConfiguration,
5353
propagateTags: props.PropagateTags,
54-
tags: props.Tags,
54+
tags: props.Tags ?? [],
5555
});
5656

5757
export const handleCreate: OnCreateHandler = async (event): Promise<ResourceHandlerReturn> => {

0 commit comments

Comments
 (0)