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

v1.5.0 doesn't understand that Transform is Fn::Transform #3467

Closed
pbudzon opened this issue Jul 5, 2024 · 1 comment · Fixed by #3470
Closed

v1.5.0 doesn't understand that Transform is Fn::Transform #3467

pbudzon opened this issue Jul 5, 2024 · 1 comment · Fixed by #3470

Comments

@pbudzon
Copy link

pbudzon commented Jul 5, 2024

CloudFormation Lint Version

1.5.0

What operating system are you using?

Mac

Describe the bug

We're trying to move from v0 of cfn-lint to v1, but the current v1.5.0 immediately blows up with the following when trying to run it against our templates (v0 works just fine).
We using Transform at top-level of our templates, but cfn-lint doesn't seem to understand it is the same as Fn::Transform and throws nonsensical errors.

If Transform is given a list, cfn-lint immediately fails with:

ValueError: Transform must be a string

That error message makes no sense, because Transform can be a string OR an array. Which is confirmed by this next error - see below.

If Transform is given an array, cfn-lint throws E1001:

E1001 {'Name': 'SomeMacro', 'Parameters': {'SomeParam': 'something'}} is not of type 'string', 'array'

Which also makes no sense, because that object is indeed an array.

If we replace Transform with Fn::Transform cfn-lint works as expected. Both versions are valid and work correctly with CloudFormation.

Expected behavior

cfn-lint should treat Transform and Fn::Transform the same in situations where they are valid yaml. Or at least show better error messages if treating them the same is not possible.

Reproduction template

Template with a list, that fails with ValueError:

AWSTemplateFormatVersion: "2010-09-09"
Description: Example

Transform:
  - Name: SomeMacro
    Parameters:
      SomeParam: something

Resources:
  SillyParameter:
    Type: AWS::SSM::Parameter
    Properties:
      DataType: text
      Type: String
      Value: abc

Template with single macro, so Transform gets an array:

AWSTemplateFormatVersion: "2010-09-09"
Description: Example

Transform:
  Name: SomeMacro
  Parameters:
    SomeParam: something

Resources:
  SillyParameter:
    Type: AWS::SSM::Parameter
    Properties:
      DataType: text
      Type: String
      Value: abc
@kddejong
Copy link
Contributor

kddejong commented Jul 6, 2024

Adding support as we can. Also tagging #476 which discusses the general need of Transform support.

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

Successfully merging a pull request may close this issue.

2 participants