Cfn-python-lint: Cloudformation Spec vs Documentation

Created on 7 May 2018  Â·  12Comments  Â·  Source: aws-cloudformation/cfn-python-lint

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-defaultcachebehavior

CloudFormation Spec has this value as not required but the documentation has it as required. Which one is it and where does the fix go?

spec bug

Most helpful comment

I've alerted the service team of the issues with the resource spec. Reclassified as a big and will leave open until the internal ticket is closed.

All 12 comments

Same goes for the Origins.

These values are actually mandatory, so the Spec is incorrect in this one...

I've alerted the service team of the issues with the resource spec. Reclassified as a big and will leave open until the internal ticket is closed.

This may be a similar issue (I'm not sure how to check the spec):

I have a custom resource

AppServiceDesiredCountRolloverResource:
    Type: "Custom::EcsServiceSizeRollover"
    Version: "1.0"
    Properties:
      ClusterName: !Ref ECSCluster
      .....

Which gets Invalid resource attribute Version for resource AppServiceDesiredCountRolloverResource

The docs for custom resources list a "Version": "1.0" top-level attribute on custom resource definitions.

This one is perhaps a different case. For Lambda functions, the Cfn docs and spec say the memory limit is 1536, but the Lambda docs and reality say the limit is 3008 (CloudFormation accepts templates with a value of 3008).

@farski the Version is on us. I will work to fix that. Sorry about that.

What error are you getting for the Lambda one? We should have updated our check to 3008.
https://github.com/awslabs/cfn-python-lint/blob/master/src/cfnlint/rules/resources/lmbd/FunctionMemorySize.py#L41 Accidentally used the CloudFormation docs the first time as you had mentioned but it should be fixed now.

but the other qualifier is it be a multiple of 64 which we also test for.

@kddejong You must specify a value that is greater than or equal to 128, and it must be a multiple of 64. You cannot specify a size larger than 1536. The default value is 128 MB at 3008

(for MemorySize: 3008)

Yup, that's definitely an old version of the linter. You can find that exact message here, with the higher max value, in the code:
https://github.com/awslabs/cfn-python-lint/blob/779ccc8c2430dc9091012255aacd2d74af873380/src/cfnlint/rules/resources/lmbd/FunctionMemorySize.py#L28-L36

You may need to do a pip install cfn-lint --upgrade and make sure you're running v.0.2.0 or 0.2.1.

@farski https://github.com/awsdocs/aws-cloudformation-user-guide/pull/68/ also I have submitted and now need to rebase that pull request.

Ok, just merged the "version" piece. You can build from code to get both fixes now, or wait until the next version to upgrade via pip.

@cmmeyer Hm, I'll dig into this some more because when I upgrade I get Requirement already up-to-date: cfn-lint in /usr/local/lib/python3.6/site-packages (0.2.1). I only first installed this two days ago.

It looks like I'm still getting the error on 0.2.1.

Last login: Thu Jun 14 06:31:01 on ttys001
~ â–¶ cfn-lint --template /Users/farski/Repositories/Infrastructure/stacks/dovetail-stitch-lambda.yml
W8001 Condition CreateProductionResources not used
/Users/farski/Repositories/Infrastructure/stacks/dovetail-stitch-lambda.yml:4:3

W2001 Parameter OpsWarnMessagesSnsTopicArn not used.
/Users/farski/Repositories/Infrastructure/stacks/dovetail-stitch-lambda.yml:6:3

W2001 Parameter OpsErrorMessagesSnsTopicArn not used.
/Users/farski/Repositories/Infrastructure/stacks/dovetail-stitch-lambda.yml:8:3

W2001 Parameter EnvironmentTypeAbbreviation not used.
/Users/farski/Repositories/Infrastructure/stacks/dovetail-stitch-lambda.yml:16:3

E2530 You must specify a value that is greater than or equal to 128, and it must be a multiple of 64. You cannot specify a size larger than 1536. The default value is 128 MB at 3008
/Users/farski/Repositories/Infrastructure/stacks/dovetail-stitch-lambda.yml:95:7

~ â–¶ cfn-lint --version                                                                                                     
cfn-lint 0.2.1

This is interesting -- that says python3.6, but your error on the VS code side was 2.7. I wonder if there are some pip shenanigans going on here?

I noticed pip3 was having trouble upgrading me from 0.1.0 to 0.2.1 -- I did a bunch of pip3 uninstall cfn-lint and pip3 install cfn-lint without getting a new version.

I would try to clean up all current versions on your machine (pip2 uninstall cfn-lint and/or pip3 uninstall cfn-lint) then pip3 install cfn-lint --no-cache --upgrade and see if you get a nice, clean install with the higher memory cap.

Going to close this with the merge of #393. Release coming shortly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kddejong picture kddejong  Â·  3Comments

miparnisari picture miparnisari  Â·  3Comments

KarthickEmis picture KarthickEmis  Â·  4Comments

Satak picture Satak  Â·  4Comments

mikecee picture mikecee  Â·  4Comments