Skip to content

validate does not return useful messages #4

@ranman

Description

@ranman

Given a template:

AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
  VoteSpacesTabs:
    Type: "AWS::Serverless::Function"
    Properties:
      Runtime: python3.6
      Handler: lambda_function.lambda_handler
      Policies: AmazonDynamoDBFullAccess
      Environment:
        Variables:
          TABLE_NAME: !Ref VotesTable
      Events:
        Vote:
          Type: Api
          Properties:
            Path: /vote
            Method: post

Invoking:
sam validate
returns:
Valid!

Should it return valid given that we have no code-uri or other required attributes? What exactly is it validating?

Given this template:

AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
  VotesTable:
    Type: "AWS::Serverless::SimpleTable"
  VoteSpacesTabs:
    Type: "AWS::Serverless::Function"
    Properties:
      Runtime: python3.6
      Handler: lambda_function.lambda_handler
      Policies: AmazonDynamoDBFullAccess
      Environment:
        Variables:
          TABLE_NAME: !Ref VotesTable
      Events:
        Vote:
          Type: Api
          Properties:
            Path: /vote
            Method: post

Invoking
sam validate
Returns:
ERROR: Failed to read the resources line numbers. This usually means that the template contains invalid indentation. Please check it and try again

This error message isn't helpful in determining what's wrong. I still haven't figured out what's wrong.

However both templates are valid from the point of view of cloudformation:
aws cloudformation validate-template --template-body file://template.yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions