vscode-yaml icon indicating copy to clipboard operation
vscode-yaml copied to clipboard

CloudFormation ref in Fn:GetAtt and Fn:FindInMap shows validations errors Incorrect type. Expected "string". yaml-schema: aws://cloudformation.schema.json

Open lirem opened this issue 2 years ago • 6 comments

Describe the bug

I have "Incorrect type. Expected "string".yaml-schema: aws://cloudformation.schema.json" error, but aws is working normally with this template. Screenshot 2023-01-06 at 11 26 41 Screenshot 2023-01-06 at 11 26 04

Expected Behavior

Nothing shoud be highlighted, because it's working template

Environment

  • VsCode mac

lirem avatar Jan 06 '23 10:01 lirem

Similar problem. And to add to this I have added all of the yaml.customTags for each of other intrinsic functions of CloudFormation.

ghost avatar Jan 11 '23 21:01 ghost

Yeah, the best way when the YAML extension still doesn't work is to use the CloudFormation Linter extension. It works very well with CloudFormation and even helps you with some errors and gives you warnings(e.g. defined but not used resources)

lirem avatar Jan 11 '23 21:01 lirem

I'm seeing this as well. I'd really like this fixed, I like to use the CFN extension provided by aws-scripting-guy as I get snippets and all sorts of stuff.

allenfisher avatar Jun 19 '23 17:06 allenfisher

Have a look at https://github.com/redhat-developer/vscode-yaml/issues/669#issuecomment-1136338006 for a list of intrinsic functions that you can add to your settings. It's in short form but you could use the long forms listed on https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html

I use the CloudFormation short form so the above works for me but you'd need to change to the long form based on your example. That and for !GetAtt if you use the short form syntax it works.

AllocationId: !GetAtt PublicSubnet1EIP.AllocationId

I haven't yet worked out how to deal with AvailabilityZone: !Select [ 1, !GetAZs '' ] returning a Incorrect type. Expected "string" error.

paulJRCurtis avatar Jul 11 '23 18:07 paulJRCurtis