This is a fork of the linter-js-yaml
package. It will parse your YAML as well as the newly released CloudFormation YAML files in Atom with cloudformation-js-yaml-schema through js-yaml, exposing any issues reported.
Great care has been put into making sure the schema can be updated separately from the linter, since it is changed frequently by AWS. The schema includes the correct YAML type through trial and error since it is not documented by AWS. New tags will be added to the schema, and this package will update in turn. Please feel free to open a PR on cloudformation-js-yaml-schema
to gain support if I don't get to it before you do.
The following template will produce an error:
AWSTemplateFormatVersion: "2010-09-09"Description: Demo Linux StackMetadata:AWS::CloudFormation::Interface:ParameterGroups:-Label:default: Instance ConfigurationParameters:- LaunchInstance- ImageId- InstanceType- KeyName- VolumeSizeParameters:ImageId:Type: AWS::EC2::Image::IdDefault: ami-f173cc91InstanceType:Type: StringDefault: t2.largeKeyName:Type: AWS::EC2::KeyPair::KeyNameDefault: ec2-keypairVolumeSize:Type: NumberDefault: 8LaunchInstance:Default: falseAllowedValues:- true- falseConditions:DoLaunchInstance: !Equals !Ref LaunchInstance true #this will error in linterResources:LinuxBox:Type: AWS::EC2::InstanceCondition: DoLaunchInstanceCreationPolicy:ResourceSignal:Timeout: PT25MMetadata:AWS::CloudFormation::Init:config:packages:yum:htop: []Properties:InstanceInitiatedShutdownBehavior: stopImageId: !Ref ImageIdInstanceType: !Ref InstanceTypeKeyName: !Ref KeyNameIamInstanceProfile: !Ref InstanceProfileMonitoring: falseNetworkInterfaces:-DeleteOnTermination: trueDescription: !Sub LinuxBox Primary Netint from ${AWS::StackName}DeviceIndex: 0SubnetId: !Ref InstanceSubnetIdAssociatePublicIpAddress: falseGroupSet:- !Ref LinuxSecurityGroupBlockDeviceMappings:-DeviceName: /dev/sda1Ebs:VolumeType: gp2DeleteOnTermination: trueVolumeSize: !Ref VolumeSizeUserData:Fn::Base64: !Sub |#!/bin/bash -xeyum update -y aws-cfn-bootstrap/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource LaunchConfig --region ${AWS::Region}/opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource WebServerGroup --region ${AWS::Region}
$ apm install linter-js-cloudformation-yaml
You can add additional custom tags and configure linter-js-cloudformation-yaml by editing ~/.atom/config.cson (choose Open Your Config in Atom menu) or in Preferences:
'linter-js-cloudformation-yaml':'customTags': ["!yaml""!include"]
customTags
: List of YAML custom tags. (Default: scalar)Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.