Open lirem opened 1 year ago
Similar problem. And to add to this I have added all of the yaml.customTags for each of other intrinsic functions of CloudFormation.
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)
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.
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.
I am having a similar problem with:
Api:
Type: "AWS::Serverless::Api"
Properties:
Name: !Join ["-", ["foo", !Ref "bar"]]
I understand that it is not possible to infer the return type from custom tags at this time. Perhaps a way to define said return type would help? Or otherwise a way to disable validations where custom tags are used would be nice.
I gave up and I disabled the validator by setting “yaml.validate”: false, in .vscode\settings.json It changes the color of the key and value text, so it's still better than editing directly in Notepad!
Describe the bug
I have "Incorrect type. Expected "string".yaml-schema: aws://cloudformation.schema.json" error, but aws is working normally with this template.
Expected Behavior
Nothing shoud be highlighted, because it's working template
Environment