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

YAML anchors & key overrides #2993

Open
2 tasks
krystof-k opened this issue Dec 30, 2023 · 2 comments
Open
2 tasks

YAML anchors & key overrides #2993

krystof-k opened this issue Dec 30, 2023 · 2 comments
Labels
researching Researching the issue

Comments

@krystof-k
Copy link

Is this feature request related to a new rule or cfn-lint capabilities?

rules

Describe the feature you'd like to request

I'm using YAML anchors like this:

Resources:
  Common:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: ./stack.yaml
      Parameters:
        &CommonParameters
        # Common parameters to be included in the stacks below
        Image: !Ref PG08Image
        # Specific parameters to be overridden in the stacks below
        Name: Common
  Web:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: ./stack.yaml
      Parameters:
        <<: *CommonParameters
        Name: Web

Which results in

E0000 Duplicate found "Name" (line 11)
template.yaml:11:9

Describe the solution you'd like

It would be great if this case (duplicate keys) is a separate rule and can be turned off. Turning of E0000 didn't work for me and I would probably not even want that.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • ⚠️ This feature might incur a breaking change
@krystof-k
Copy link
Author

krystof-k commented Dec 30, 2023

However when I run the lint on the packaged template (aws cloudformation package), it passes fine as the initial values are omitted. So this is not such a huge deal, although having be able to lint the source files would be nice.

@kddejong kddejong added the researching Researching the issue label Jan 2, 2024
@kddejong
Copy link
Contributor

kddejong commented Jan 2, 2024

Going to think on this one. One of the issues we have is since we are parsing into a python dict we lose the second key. What this would probably look like is we continue to parse, raise the error and the final object. I think this would be possible

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

No branches or pull requests

2 participants