Skip to content

ContentUri' requires Bucket and Key properties to be specified. when using local deployment #4194

@mateimicu

Description

@mateimicu

CloudFormation Lint Version

cfn-lint 1.38.0

What operating system are you using?

Mac

Describe the bug

I have the following template that uses an if to determine if the layer is used from AWS or using a local path.
This is a quality of life for developers.

I am using docker build docker run --rm -v pwd:/data cfn-lint:latest /data/template.yml

I am getting this error

E0001 Error transforming template: Resource with id [ConnectDependenciesPackageLayeraef2224e3b] is invalid. 'ContentUri' requires Bucket and Key properties to be specified.

I

Expected behavior

Handling the if statement and erroring out

Reproduction template

  ConnectDependenciesPackageLayer:
    Type: AWS::Serverless::LayerVersion
    Properties:
      CompatibleArchitectures:
        - "x86_64"
      CompatibleRuntimes:
        - "python3.12"
      ContentUri: !If
        - samLocalDeploy
        - ".layers/packages/local"
        - Bucket: !Ref ...
          Key: !Sub "....zip"
    Metadata:
      BuildMethod: python3.12
      BuildArchitecture: x86_64

I think this is similar to #2658

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions