Cfn-python-lint: Validate UpdatePolicy for AutoScalingRollingUpdate

Created on 24 Sep 2018  路  5Comments  路  Source: aws-cloudformation/cfn-python-lint

cfn-lint version: (cfn-lint --version) 0.7.2

Description of issue.

Using a template like:

Resources:
  AutoScalingGroup:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      # ...
      MinSize: "1"
      MaxSize: "1"
      # ...
    UpdatePolicy:
      AutoScalingRollingUpdate:
        MinInstancesInService: 1

will fail at deployment time with an error from CloudFormation like:

AWS::AutoScaling::AutoScalingGroup AutoScalingGroup UPDATE_FAILED: MinInstancesInService must be less than the autoscaling group's MaxSize

It would be nice to have protection against this. I guess there are other constraints, some are in the docs. I submitted a docs PR for this one.

enhancement new rule

Most helpful comment

Started with rule E3016 to check the basic configuration of the UpdatePolicy (attributes, values are of the correct type), etc.

Moving down the chain to this one next.

All 5 comments

Agreed. This would be a good business logic addition to compare values. I'll label this as an enhancement.

Started with rule E3016 to check the basic configuration of the UpdatePolicy (attributes, values are of the correct type), etc.

Moving down the chain to this one next.

I have an issue with UpdatePolicy validation. I am using a different update policy for spot instances (replacingupdate) and regular instances (rolling update)

So something like:

UpdatePolicy:
            !If
                - spotInstances
                - AutoScalingReplacingUpdate:
                      WillReplace: true
                - AutoScalingRollingUpdate:
                      MinInstancesInService: !Ref DedicatedIngestNodeCount
                      MinSuccessfulInstancesPercent: 100
                      MaxBatchSize: 1
                      PauseTime: PT15M
                      WaitOnResourceSignals: true
                      SuspendProcesses:
                          - HealthCheck
                          - ReplaceUnhealthy
                          - AZRebalance
                          - AlarmNotification
                          - ScheduledActions

But this gives the following linting error:

E3016 UpdatePolicy doesn't support type Fn::If

This code actually works in CFN, so can the linting be fixed for this?

Thanks!

Sorry @kalpik I lost track of this. I have created pull request #468 totally rewritten to handle conditions on each level. Used your example for adding to tests. Thanks for reporting this.

I am getting error E3016 UpdatePolicy doesn't support type AutoScalingRollingUpdate from this AWS example:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-autoscaling.html#scenario-as-updatepolicy

Was this page helpful?
0 / 5 - 0 ratings

Related issues

flomotlik picture flomotlik  路  3Comments

ow-krioles picture ow-krioles  路  5Comments

kddejong picture kddejong  路  5Comments

mikecee picture mikecee  路  4Comments

kddejong picture kddejong  路  3Comments