Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unresolved tag: !Ref in CloudFormation Template #669

Closed
mcflynt opened this issue Dec 28, 2021 · 7 comments
Closed

Unresolved tag: !Ref in CloudFormation Template #669

mcflynt opened this issue Dec 28, 2021 · 7 comments
Labels

Comments

@mcflynt
Copy link

mcflynt commented Dec 28, 2021

##Description
When the extension is running and I am creating a CloudFormation template, the valid syntax of !Ref EnvironmentName, for example, where EnvironmentName is a Parameter in the template is not recognized. The extension produces a 'Problem' of 'Unresolved tag: !Ref'

Expected Behavior

No syntax errors should be reported as this is a valid syntax

Current Behavior

image

image

Steps to Reproduce

  1. Create CloudFormation template with any resource (Easiest is an S3 bucket)
  2. Add in a parameter in the Parameters section of the template called EnvironmentName
  3. In the Tags property on the S3 bucket, enter the key value pairs as in the screen-print above:
    Tags:
  • Key: 'environment-name'
  • Value: !Ref EnvironmentName

Environment

  • [x ] Windows

Note

The same thing happens with the also valid inline !Sub
Example: BucketName: !Sub 'my-first-bucket-${EnvironmentName}' is highlighted and the Problems report shows Unresolved tag !Sub

@evidolob
Copy link
Collaborator

@mcflynt !Ref is not standard tag, to fix error you need to add it to custom tag settings.

@gorkem
Copy link
Collaborator

gorkem commented Feb 27, 2022

Closing. Please let us know if there is anything else we can do.

@gorkem gorkem closed this as completed Feb 27, 2022
@lmammino
Copy link

in your vscode settings.json:

{
    "yaml.customTags": [
        "!Sub scalar"
    ]
}

@jroeber
Copy link

jroeber commented May 24, 2022

Here's the full list based on the AWS CloudFormation intrinsic function docs

{
    "yaml.customTags": [
        "!Base64 scalar",
        "!Cidr scalar",
        "!And sequence",
        "!Equals sequence",
        "!If sequence",
        "!Not sequence",
        "!Or sequence",
        "!Condition scalar",
        "!FindInMap sequence",
        "!GetAtt scalar",
        "!GetAtt sequence",
        "!GetAZs scalar",
        "!ImportValue scalar",
        "!Join sequence",
        "!Select sequence",
        "!Split sequence",
        "!Sub scalar",
        "!Transform mapping",
        "!Ref scalar",
    ]
}

1 Jun 22: Edited to fix !GetAtt.
7 Jun 22: Added !GetAtt sequence back in, since it is valid (the output of eksctl uses it, for example)

@Unintendedz
Copy link

Here's the full list based on the AWS CloudFormation intrinsic function docs

{
    "yaml.customTags": [
        "!Base64 scalar",
        "!Cidr scalar",
        "!And sequence",
        "!Equals sequence",
        "!If sequence",
        "!Not sequence",
        "!Or sequence",
        "!Condition scalar",
        "!FindInMap sequence",
        "!GetAtt sequence",
        "!GetAZs scalar",
        "!ImportValue scalar",
        "!Join sequence",
        "!Select sequence",
        "!Split sequence",
        "!Sub scalar",
        "!Transform mapping",
        "!Ref scalar",
    ]
}

Thanks for this list!

I am not familiar with yaml, it seems !GetAtt sequence not working for me, I've tried to add !GetAtt scalar and it worked.

image

eshinn added a commit to eshinn/dot-files that referenced this issue Jun 21, 2022
Update YAML customTags per this issue:
redhat-developer/vscode-yaml#669
@Patrick-Da-Silva-RR
Copy link

Isn't there a way that those settings are part of the extension?

@saadelkenawy
Copy link

I have this problem how to fix it Please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants