When I try to deploy my AWS SAM YAML file, it fails saying the !Ref is an unknown tag.
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
First validate your extensions, I eliminated the extension called Redhat yaml and problems solved, I have the next extensions and everything is ok.
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"
]
The CloudFormation Visual Studio Code extension should manage these tags for you
This error message is almost certainly a false-positive from the YAML parser your IDE is using. To assess the correctness of the AWS SAM template, you should use cfn-python-lint instead, which comes with plugins for most major IDEs (unfortunately not for Visual Studio, but for Visual Studio Code).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With