GithubHelp home page GithubHelp logo

yyolk / cloudformation-js-yaml-schema Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 14.0 38 KB

Schema to ignore CloudFormation YAML local tags while parsing

JavaScript 100.00%
cloudformation-yaml schema parsing aws cloudformation

cloudformation-js-yaml-schema's Introduction

cloudformation-js-yaml-schema Build Status

Schema to ignore CloudFormation YAML local tags while parsing, ie: !Ref, !Base64

For utility in templates and build wrappers

See tags.json for currently supported local tags

Use Cases

I've created this package primarily for use in creating CloudFormation templates

Dependent Of

cloudformation-js-yaml-schema's People

Contributors

dv8fromtheworld avatar martysweet avatar mfsgr avatar studds avatar yyolk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cloudformation-js-yaml-schema's Issues

!Ref & !ImportValue tag missing

Hello,

Any reason why !Ref & !ImportValue tag is not added?

i tried add manually !Ref via config.cson but it seems not to work:

"linter-js-cloudformation-yaml":
    customTags: [
        "!Ref"
    ]

obraz

And screenshot for !ImportValue not found
obraz

Separate Schema from utility for minimizing require size

Right now in addition to the schema, there are several exports to assist with scope

These are likely unnecessary for most use cases and can be removed or isolated into another export that can be ignored.

The schema should export default as well as CLOUDFORMATION_SCHEMA for backwards compatibility

- Version: 2012-10-17 getting parsed as a date

I've got a template:

Resources:
    Function:
        Type: 'AWS::Serverless::Function'
        Properties:
            CodeUri: code/
            Handler: code.handler
            Runtime: nodejs8.10
            Policies:
                - Version: 2012-10-17
                  Statement:
                      - Effect: Allow
                        Action: 'ses:SendRawEmail'
                        Resource: !Sub 'arn:aws:ses:*:*:identity/*'

When I read it and then write it out again, - Version: 2012-10-17 becomes - Version: 2012-10-17T00:00:00.000Z, which is invalid. - Version: '2012-10-17' is fine, but I'm hoping there's a way to make this more robust, and simply not parse the dates.

Any hints?

ECS roles error reported for ECS tasks

In a "Type: AWS::ECS::TaskDefinition"
I have :
"ExecutionRoleArn: !Ref ExecRole"
Where ExecRole is a "Type: AWS::IAM::Role"

And the cloudformation validate-template passes the template and it works when built.
However, the linter is reporting an error :
Property "ExecutionRoleArn" has no valid Refs to Resources at Resources/keycloakTask/Properties/ExecutionRoleArn/Ref 126:7

!Sub with Mapping

Currently, cloudformation-js-yaml-schema expects !Sub to be of a Scalar type, expecting a string. The following YAML would be invalid within the Schema.

Name: !Sub
  - www.${Domain}
  - { Domain: !Ref RootDomainName }

According to http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html the !Sub function should support type String (for !Sub ${something} and a Sequence to allow for mapping functionality.

I will create a pull request with the !Sub type in the Sequence tags array and with accompanying unit tests. This will allow for both formats of the !Sub shorthand.

Suggest moving js-yaml dependency to peerDependencies

I think this wonderful library is probably only really used in conjunction with js-yaml itself. So assuming that users will always have js-yaml anyway, I think it would make sense to move the js-yaml dependency of this package to peerDependencies, so that npm install cloudformation-js-yaml-schema will not insist on installing its own version.

unknown tag !<!ImportValue>

With the tests in #12 (which is valid CloudFormation), I get this error upon running npm test:

> node test.js


/srv/app/node_modules/js-yaml/lib/js-yaml/loader.js:171
  throw generateError(state, message);
  ^
YAMLException: unknown tag !<!ImportValue> at line 31, column 1:

    ^
    at generateError (/srv/app/node_modules/js-yaml/lib/js-yaml/loader.js:165:10)
    at throwError (/srv/app/node_modules/js-yaml/lib/js-yaml/loader.js:171:9)
    at composeNode (/srv/app/node_modules/js-yaml/lib/js-yaml/loader.js:1401:7)
    at readBlockMapping (/srv/app/node_modules/js-yaml/lib/js-yaml/loader.js:1062:11)
    at composeNode (/srv/app/node_modules/js-yaml/lib/js-yaml/loader.js:1332:12)
    at readBlockMapping (/srv/app/node_modules/js-yaml/lib/js-yaml/loader.js:1062:11)
    at composeNode (/srv/app/node_modules/js-yaml/lib/js-yaml/loader.js:1332:12)
    at readBlockMapping (/srv/app/node_modules/js-yaml/lib/js-yaml/loader.js:1062:11)
    at composeNode (/srv/app/node_modules/js-yaml/lib/js-yaml/loader.js:1332:12)
    at readDocument (/srv/app/node_modules/js-yaml/lib/js-yaml/loader.js:1492:3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.