You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When evaluating a Serverless.yml file, Sub parameters that use dot notation are not matched with valid_params, leading to false E1019 errors.
E1019 Parameter SiteBucket.Arn for Fn::Sub not found at resources/Resources/SiteBucketPolicy/Properties/PolicyDocument/Statement/0/Resource/Fn::Sub
E1019 Parameter Distribution.Id for Fn::Sub not found at resources/Resources/SiteBucketPolicy/Properties/PolicyDocument/Statement/0/Condition/StringEquals/AWS:SourceArn/Fn::Sub
I managed to make 2 adjustments that "fixed" the symptoms, although I am not familiar enough with the codebase to know if these qualify as anything more than hacks.
Serverless files embed the Resources node under another node named resources (see my example). Because of this, Template.get_resource_names() returns an empty list. As a hack, I changed get_resource_names so that resources = self.template.get("resources", {}) is replaced with resources = self.template.get("resources", {}).get("Resources", {}), returning the full list.
Once the resource names are resolved, Sub params that use dot notation do not match, as only the first segment of the parameter is in the valid_params list. In order to use dot notation to refer to properties on the resource param, I had to change line 131 of Sub.py from if parameter not in valid_params: to if parameter.split('.')[0] not in valid_params:. This resolves all issues, although it does seem hacky, like Add testing #1.
Hopefully this is just something that I am doing wrong, rather than a real bug.
I need to validate this (E1019 {'Fn::Sub': '${ProductionProvisionedConcurrency}'} is not of type 'integer'). There is an odd issue when doing a GetAtt to an integer but I think in the case of a parameter it works as you have pointed out.
CloudFormation Lint Version
0.83.8
What operating system are you using?
MacOS
Describe the bug
When evaluating a Serverless.yml file,
Sub
parameters that use dot notation are not matched withvalid_params
, leading to false E1019 errors.I managed to make 2 adjustments that "fixed" the symptoms, although I am not familiar enough with the codebase to know if these qualify as anything more than hacks.
Resources
node under another node namedresources
(see my example). Because of this,Template.get_resource_names()
returns an empty list. As a hack, I changedget_resource_names
so thatresources = self.template.get("resources", {})
is replaced withresources = self.template.get("resources", {}).get("Resources", {})
, returning the full list.Sub
params that use dot notation do not match, as only the first segment of the parameter is in thevalid_params
list. In order to use dot notation to refer to properties on the resource param, I had to change line 131 ofSub.py
fromif parameter not in valid_params:
toif parameter.split('.')[0] not in valid_params:
. This resolves all issues, although it does seem hacky, like Add testing #1.Hopefully this is just something that I am doing wrong, rather than a real bug.
Expected behavior
E1019 is not returned, and linting passes.
Reproduction template
The text was updated successfully, but these errors were encountered: