File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
adapters/cloudformation/aws/ec2
scanners/cloudformation/parser Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -338,6 +338,34 @@ Resources:
338
338
},
339
339
},
340
340
},
341
+ {
342
+ name : "empty" ,
343
+ source : `---
344
+ AWSTemplateFormatVersion: 2010-09-09
345
+ Description: Godd example of excessive ports
346
+ Resources:
347
+ NetworkACL:
348
+ Type: AWS::EC2::NetworkAcl
349
+ Rule:
350
+ Type: AWS::EC2::NetworkAclEntry
351
+ Properties:
352
+ NetworkAclId:
353
+ Ref: NetworkACL` ,
354
+ expected : ec2.EC2 {
355
+ NetworkACLs : []ec2.NetworkACL {
356
+ {
357
+ Rules : []ec2.NetworkACLRule {
358
+ {
359
+ Action : types .StringTest ("allow" ),
360
+ Type : types .StringTest ("ingress" ),
361
+ FromPort : types .IntTest (- 1 ),
362
+ ToPort : types .IntTest (- 1 ),
363
+ },
364
+ },
365
+ },
366
+ },
367
+ },
368
+ },
341
369
}
342
370
343
371
for _ , tt := range tests {
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ import (
10
10
)
11
11
12
12
func (p * Property ) IsConvertableTo (conversionType cftypes.CfType ) bool {
13
+ if p .IsNil () {
14
+ return false
15
+ }
16
+
13
17
switch conversionType {
14
18
case cftypes .Int :
15
19
return p .isConvertableToInt ()
@@ -62,6 +66,9 @@ func (p *Property) isConvertableToInt() bool {
62
66
}
63
67
64
68
func (p * Property ) ConvertTo (conversionType cftypes.CfType ) * Property {
69
+ if p .IsNil () {
70
+ return nil
71
+ }
65
72
66
73
if p .Type () == conversionType {
67
74
return p
You can’t perform that action at this time.
0 commit comments