JAVA CDK version 0.9.2
Unable to see CreationPolicy or UpdatePolicy when running 'cdk synth' on the following code attached to the autoscaling Resource:
How do you attach it, with dependsOn you have an addDependency, but on see a getOptions() then a setCreationPolicy, but do not see anything in the 'cdk sythn'
-
Code
-
Output from Synth
-
Code:
AutoScalingGroupResource autoScalingGroupResource = new AutoScalingGroupResource(this, "AutoScalingGroup",
AutoScalingGroupResourceProps.builder()
.withAutoScalingGroupName(new FnSub("SMS-${ProjectID}-ServerGroup"))
.withLaunchConfigurationName(launchConfigurationResource.getLaunchConfigurationName())
.withMinSize(minSizeParam.getValue().toString()) //
.withMaxSize(maxSizeParam.getValue().toString()) //
.withDesiredCapacity(desiredCapacityParam.getValue().toString())
.withTargetGroupArns(Collections.singletonList(targetGroupResource.getTargetGroupArn()))
.withVpcZoneIdentifier(subnets)
.withHealthCheckType("ELB")
.withHealthCheckGracePeriod(120)
.build());
//TODO DOES not attach the Policies
autoScalingGroupResource.getOptions().setCreationPolicy(CreationPolicy.builder().withResourceSignal(ResourceSignal.builder().withCount(0).build()).build());
autoScalingGroupResource.getOptions().setUpdatePolicy(UpdatePolicy.builder().withAutoScalingRollingUpdate(AutoScalingRollingUpdate.builder()
.withMinInstancesInService(1)
.withMaxBatchSize(1)
.withPauseTime("PT15M")
.withWaitOnResourceSignals(true)
.build()).build());
ResourceOptions resourceOptions = ResourceOptions.builder()
.withCreationPolicy(CreationPolicy.builder().withResourceSignal(ResourceSignal.builder().withCount(0).build()).build())
.withUpdatePolicy(UpdatePolicy.builder().withAutoScalingRollingUpdate(AutoScalingRollingUpdate.builder()
.withMinInstancesInService(1)
.withMaxBatchSize(1)
.withPauseTime("PT15M")
.withWaitOnResourceSignals(true)
.build()).build())
.build();
Output:
AutoScalingGroup:
Type: 'AWS::AutoScaling::AutoScalingGroup'
Properties:
MaxSize:
Ref: MaxSize
MinSize:
Ref: MinSize
AutoScalingGroupName:
'Fn::Sub': 'SMS-${ProjectID}-ServerGroup'
DesiredCapacity:
Ref: DesirecCapacity
HealthCheckGracePeriod: 120
HealthCheckType: ELB
LaunchConfigurationName:
Ref: LaunchConfiguration
TargetGroupARNs:
-
Ref: TargetGroup
VPCZoneIdentifier:
-
'Fn::ImportValue':
'Fn::Sub': 'SMS-${ProjectID}-VPC-PrivateSubnetA'
-
'Fn::ImportValue':
'Fn::Sub': 'SMS-${ProjectID}-VPC-PrivateSubnetC'
JAVA CDK version 0.9.2
Unable to see CreationPolicy or UpdatePolicy when running 'cdk synth' on the following code attached to the autoscaling Resource:
How do you attach it, with dependsOn you have an addDependency, but on see a getOptions() then a setCreationPolicy, but do not see anything in the 'cdk sythn'
Code
Output from Synth
Code:
Output: