From bec537d90dd75d63567f643b9855c5ba7f027b6c Mon Sep 17 00:00:00 2001 From: nachundu Date: Mon, 14 Sep 2020 10:53:17 +0530 Subject: [PATCH] fixed hash for missing launch config properties --- .../src/autoscaling/launch-configuration.ts | 11 +++++++++-- src/lib/cdk-constructs/src/vpc/asg.ts | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/lib/cdk-constructs/src/autoscaling/launch-configuration.ts b/src/lib/cdk-constructs/src/autoscaling/launch-configuration.ts index f4ff47373..7f315afff 100644 --- a/src/lib/cdk-constructs/src/autoscaling/launch-configuration.ts +++ b/src/lib/cdk-constructs/src/autoscaling/launch-configuration.ts @@ -1,16 +1,23 @@ import hashSum from 'hash-sum'; import * as cdk from '@aws-cdk/core'; -import * as ssm from '@aws-cdk/aws-ssm'; import * as autoscaling from '@aws-cdk/aws-autoscaling'; export type LaunchConfigurationProps = autoscaling.CfnLaunchConfigurationProps; +/** + * Added to update the hash for Rsyslog UserData properties + */ +interface LaunchConfigurationCustomProps extends LaunchConfigurationProps { + centralBucketName?: string; + logGroupName?: string; +} + /** * Wrapper around CfnLaunchConfiguration. The construct adds a hash to the launch configuration name that is based on * the launch configuration properties. The hash makes sure the budget gets replaced correctly by CloudFormation. */ export class LaunchConfiguration extends autoscaling.CfnLaunchConfiguration { - constructor(scope: cdk.Construct, id: string, props: LaunchConfigurationProps) { + constructor(scope: cdk.Construct, id: string, props: LaunchConfigurationCustomProps) { super(scope, id, props); const hash = hashSum({ ...props, path: this.node.path }); diff --git a/src/lib/cdk-constructs/src/vpc/asg.ts b/src/lib/cdk-constructs/src/vpc/asg.ts index 47fdc4d6f..52cbb39fd 100644 --- a/src/lib/cdk-constructs/src/vpc/asg.ts +++ b/src/lib/cdk-constructs/src/vpc/asg.ts @@ -41,6 +41,8 @@ export class RsysLogAutoScalingGroup extends cdk.Construct { }, }, ], + centralBucketName: props.centralBucketName, + logGroupName: props.logGroupName, }); const autoScalingGroupSize = props.desiredInstanceHosts;