Appliscale / perun

A command-line validation tool for AWS Cloud Formation that allows to conquer the cloud faster!
https://perun-for-aws.appliscale.io
Apache License 2.0
92 stars 8 forks source link

Validation Bug #177

Open maxiwoj opened 5 years ago

maxiwoj commented 5 years ago

Perun throws an error:

GOROOT=/usr/local/Cellar/go/1.9.3/libexec #gosetup
GOPATH=/Users/maksymilian/go #gosetup
/usr/local/Cellar/go/1.9.3/libexec/bin/go build -i -o /private/var/folders/0d/93p3r6493yg7p0rvl_4r983m0000gn/T/___1validate /Users/maksymilian/go/src/github.com/Appliscale/perun/main.go #gosetup
/private/var/folders/0d/93p3r6493yg7p0rvl_4r983m0000gn/T/___1validate validate testTemplates/ec2-etl.yaml #gosetup
INFO: Configuration file from the following location will be used: /Users/maksymilian/.config/perun/main.yaml
INFO: Session token will expire in 32h39m5s (2019-01-16 21:57:12)
INFO: Creating new session. Profile: appliscale Region: us-east-2
panic: interface conversion: interface {} is map[string]interface {}, not string

goroutine 1 [running]:
github.com/Appliscale/perun/helpers.findFnImportValue(0xc420706f00, 0x4e2, 0x500, 0xc420084910, 0x0, 0x0)
    /Users/maksymilian/go/src/github.com/Appliscale/perun/helpers/formathelpers.go:154 +0xab9
github.com/Appliscale/perun/helpers.ParseYAML(0xc4206f6000, 0x47a, 0x67a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /Users/maksymilian/go/src/github.com/Appliscale/perun/helpers/formathelpers.go:94 +0x663
github.com/Appliscale/perun/validator.validateTemplateFile(0x7ffeefbff8d7, 0x1a, 0x7ffeefbff8d7, 0x1a, 0xc420094c60, 0xc42028f300)
    /Users/maksymilian/go/src/github.com/Appliscale/perun/validator/localvalidator.go:91 +0x272
github.com/Appliscale/perun/validator.Validate(0xc420094c60, 0x8)
    /Users/maksymilian/go/src/github.com/Appliscale/perun/validator/localvalidator.go:63 +0x4c
main.main()
    /Users/maksymilian/go/src/github.com/Appliscale/perun/main.go:49 +0xb00
ERROR: Template testTemplates/ec2-etl.yaml is invalid!

Process finished with exit code 2

This error is thrown for such template:

AWSTemplateFormatVersion: "2010-09-09"

Parameters:
  VPCStackName:
    Type: String
  SGStackName:
    Type: String
  EC2RoleStackName:
    Type: String
  ENV:
    Type: String
    AllowedValues:
      - prod
      - staging
  InstanceType:
    Type: String
  ImageId:
    Type: String
  PublicSubnetAZ:
    Type: String

Resources:

  EC2ETL:
    Type: AWS::EC2::Instance
    Properties:
      InstanceType: !Ref InstanceType
      ImageId: !Ref ImageId
      Tags:
      - Key: Name
        Value: !Join ["-",[!Ref ENV, ETL]]
      NetworkInterfaces:
      - AssociatePublicIpAddress: True
        DeleteOnTermination: True
        GroupSet:
          - 'Fn::ImportValue': !Sub ${SGStackName}-public-icmp-sgId
          - 'Fn::ImportValue': !Sub ${SGStackName}-public-ssh-sgid
        SubnetId:
          'Fn::ImportValue': !Sub ${VPCStackName}-${PublicSubnetAZ}-public-subnetId-01
        DeviceIndex: 0
      IamInstanceProfile:
        'Fn::ImportValue': !Sub ${EC2RoleStackName}-instance-profile-name

Outputs:
  ECETLPublicIP:
    Value:
      Fn::GetAtt: [EC2ETL, PublicIp]
    Description: Instance profile name
maxiwoj commented 5 years ago

Validation Bug

SylwiaGargula commented 5 years ago

https://github.com/Appliscale/perun/tree/ValidationBug