LoginSignup
1
1

VSCodeのCloudFormation Yamlファイルにてyaml.customTagsで指定してるのに Unresolved tag が出るときの対応

Posted at

事象

こちらの記事様のように"yaml.customTags"を以下のように設定しているのに、

settings.jsonの抜粋
"yaml.customTags": [
..
    "!If",
    "!Not",
    "!Or"
  ],

以下のように 指定しているはずの "!If" にて Unresolved tag で怒られてしまう。

image.png

解決

エラーを出しているYamlプラグインのドキュメント"yaml.customTags"の記述を読む。

どうやら、カスタムタグは "scalar", "sequence", "mapping" の3つの型に解釈される必要があり、"!If"のみの指定だとscalar型になろうとし、CFn表記 !If [ ] のような形はエラーになるようだ。

追加で、"!If sequence" を足し、sequence型も対応させたらエラーが消えた。

全体設定として以下の感じにしている。

settings.jsonの抜粋
    "yaml.customTags": [
        "!And",
        "!And sequence",
        "!If",
        "!If sequence",
        "!Not",
        "!Not sequence",
        "!Equals",
        "!Equals sequence",
        "!Or",
        "!Or sequence",
        "!FindInMap sequence",
        "!Base64",
        "!Base64 mapping",
        "!Cidr",
        "!Cidr sequence",
        "!Ref",
        "!Sub",
        "!GetAtt",
        "!GetAZs",
        "!ImportValue",
        "!Select",
        "!Select sequence",
        "!Split",
        "!Split sequence",
        "!Join sequence"
    ],
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1