yamlaws-cloudformationserverlessaws-serverlessaws-sam

AWS SAM YAML template - Unknown Tag !Ref


When I try to deploy my AWS SAM YAML file, it fails saying the !Ref is an unknown tag.

enter image description here

Any ideas to get around this?

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Resources:
  MySimpleFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.handler
      Runtime: nodejs4.3
      CodeUri: s3://<bucket>/MyCode.zip
      Events:
        MyUploadEvent:
          Type: S3
          Properties:
            Id: !Ref Bucket
            Events: Create
  Bucket:
    Type: AWS::S3::Bucket

Solution

  • You can add custom YAML tags in your settings.json:

    "yaml.customTags": [
      "!Equals sequence",
      "!FindInMap sequence",
      "!GetAtt",
      "!GetAZs",
      "!ImportValue",
      "!Join sequence",
      "!Ref",
      "!Select sequence",
      "!Split sequence",
      "!Sub"
    ]