aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

cdk diff / did not detect changes in asg

Open OliverEspeter opened this issue 7 years ago • 3 comments

Hi,

i changed some settings in one of my autoscaling groups and was surprised that cdk diff didn't detect a change:

const asg = new autoscaling.AutoScalingGroup( this.scope, this.fullQualifiedName + '-asg', { instanceType: this.props.instanceType, machineImage: new ec2.AmazonLinuxImage(), associatePublicIpAddress: false, updateType: autoscaling.UpdateType.RollingUpdate, desiredCapacity: this.props.desiredCapacity, vpc: this.scope.vpc, rollingUpdateConfiguration: { pauseTimeSec: 900, waitOnResourceSignals: true, maxBatchSize: 1, minSuccessfulInstancesPercent: 100, minInstancesInService: 1, } });

    const cluster = new ecs.Cluster(
        this.scope,
        this.name + '-cluster',
        {
            vpc: this.scope.vpc,
            clusterName: this.fullQualifiedName,
        }
    );
    cluster.addAutoScalingGroupCapacity(asg, {});

cdk synth generates: [...] UpdatePolicy: AutoScalingRollingUpdate: MaxBatchSize: 1 MinInstancesInService: 1 MinSuccessfulInstancesPercent: 100 WaitOnResourceSignals: true PauseTime: PT15M SuspendProcesses: - HealthCheck - ReplaceUnhealthy - AZRebalance - AlarmNotification - ScheduledActions AutoScalingScheduledAction: IgnoreUnmodifiedGroupSizeProperties: true [...]

Thats the deployed version. So now i remove my rolling-settings:

const asg = new autoscaling.AutoScalingGroup( this.scope, this.fullQualifiedName + '-asg', { instanceType: this.props.instanceType, machineImage: new ec2.AmazonLinuxImage(), associatePublicIpAddress: false, updateType: autoscaling.UpdateType.RollingUpdate, desiredCapacity: this.props.desiredCapacity, vpc: this.scope.vpc, rollingUpdateConfiguration: { pauseTimeSec: 900, waitOnResourceSignals: true, maxBatchSize: 1, minSuccessfulInstancesPercent: 100, minInstancesInService: 1, } });

    const cluster = new ecs.Cluster(
        this.scope,
        this.name + '-cluster',
        {
            vpc: this.scope.vpc,
            clusterName: this.fullQualifiedName,
        }
    );
    cluster.addAutoScalingGroupCapacity(asg, {});

cdk synth shows: [...] UpdatePolicy: AutoScalingRollingUpdate: WaitOnResourceSignals: false PauseTime: PT0S SuspendProcesses: - HealthCheck - ReplaceUnhealthy - AZRebalance - AlarmNotification - ScheduledActions AutoScalingScheduledAction: IgnoreUnmodifiedGroupSizeProperties: true [...]

But cdk diff shows: "There were no differences"

Think it´s a bug. Please verify.

Best regards Oliver

OliverEspeter avatar Mar 08 '19 11:03 OliverEspeter

Just making sure: did you make sure to compile your code using “npm run build” or “tsc”?

eladb avatar Mar 14 '19 20:03 eladb

Yes of course. I am using PHPStorm and it´s set to autocompile. Further I copied the examples above from "cdk synth...", so the code was compiled. Here is my workflow:

  • create first version in PHPStorm

  • "cdk synth" & copy code for thread

  • "cdk deploy"

  • create changes in PHPStorm

  • "cdk synth" & copy code for thread

  • "cdk diff"

OliverEspeter avatar Mar 15 '19 08:03 OliverEspeter

Update: I retested it with "cdk --version" --> 0.25.3 (build 5d40377). Now it works as aspected. I forgot to mention my cdk version above, but it was the then current.

OliverEspeter avatar Mar 15 '19 09:03 OliverEspeter