Skip to content

expanding templated_exceptions property types that require package command (E3002/W3002)#1684

Merged
kddejong merged 2 commits intomasterfrom
3002
Sep 8, 2020
Merged

expanding templated_exceptions property types that require package command (E3002/W3002)#1684
kddejong merged 2 commits intomasterfrom
3002

Conversation

@PatMyron
Copy link
Copy Markdown
Contributor

@PatMyron PatMyron commented Sep 5, 2020

fixes #1683

According to #608, this documentation seems incomplete, so I used this as the source instead


these other property types were already String:

            'AWS::AppSync::FunctionConfiguration': ['RequestMappingTemplateS3Location', 'ResponseMappingTemplateS3Location'],
            'AWS::AppSync::GraphQLSchema': ['DefinitionS3Location'],
            'AWS::AppSync::Resolver': ['RequestMappingTemplateS3Location', 'ResponseMappingTemplateS3Location'],
            'AWS::CloudFormation::Stack': ['TemplateURL'],
            'AWS::Glue::Job': ['Command.ScriptLocation'],  # not sure about this syntax

Test template:

Resources:
  StateMachine:
    Type: AWS::StepFunctions::StateMachine
    Properties:
      RoleArn: RoleArn
      DefinitionS3Location: file
  LayerVersion:
    Type: AWS::Lambda::LayerVersion
    Properties:
      Content: file
  RestApi:
    Type: AWS::ApiGateway::RestApi
    Properties:
      BodyS3Location: file

@kddejong any way this section can use templated_exceptions keys as well?

https://github.com/aws-cloudformation/cfn-python-lint/blob/df4b7bc463d301b638f0e0274ed0e41d37239092/src/cfnlint/rules/resources/properties/PropertiesTemplated.py#L34-L38

Copy link
Copy Markdown
Contributor

@kddejong kddejong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm missing something here @PatMyron

"""
templated_exceptions = {
'AWS::ApiGateway::RestApi': ['BodyS3Location'],
'AWS::ApiGateway::RestApi': ['S3Location'],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2020-09-08 at 10 54 22 AM

'AWS::Lambda::Function': ['Code'],
'AWS::Lambda::LayerVersion': ['Content'],
'AWS::ElasticBeanstalk::ApplicationVersion': ['SourceBundle'],
'AWS::StepFunctions::StateMachine': ['S3Location'],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2020-09-08 at 10 54 01 AM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @asjohnston-asf caught here: "I don't appreciate any nuance of the property type being S3Location vs DefinitionS3Location", the name of the property in the template is actually different than the name of the property type in the Resource Specification

From testing, these rules seems to be parsing the name of the property differently because of this, hence the divergence between templated_exceptions in the two rules

Copy link
Copy Markdown
Contributor

@kddejong kddejong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got it now. We are using the resource spec name not the property name. That was an unfortunate chose but I get why its the way you did this.

@kddejong kddejong merged commit 0270917 into master Sep 8, 2020
@kddejong kddejong deleted the 3002 branch September 8, 2020 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return W3002 instead of E3002 for additional resources supported by package command

2 participants