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

cfn-lint shows W1020 Fn::Sub isn't needed on Serverless LayerVersion property LayerName when a Variable is actually present #897

Closed
patrickgreenwell opened this issue May 14, 2019 · 0 comments · Fixed by #908
Assignees
Labels
bug Something isn't working

Comments

@patrickgreenwell
Copy link

patrickgreenwell commented May 14, 2019

cfn-lint version: 0.20.1

cfn-lint shows W1020 Fn::Sub isn't needed on Serverless LayerVersion property LayerName when a Variable is actually present in the layerName String of the intrinsic function Sub

Please provide as much information as possible:

sample resource:

APICommonCodeLayer:
    Type: 'AWS::Serverless::LayerVersion'
    Properties:
      Description: API common libraries
      LayerName: 
        Fn::Sub: 'api-common-code-layer-${Environment}'
      ContentUri: api/common
      CompatibleRuntimes:
        - nodejs8.10
      RetentionPolicy: Retain

Where Environment is a Paramater with the following definition:

Environment:
    AllowedValues:
      - Dev
      - Qa
      - Staging
      - Mirror
      - Prod
    ConstraintDescription: You must specify a valid EnvironmentValue
    Default: Dev
    Description: Environment for to Deploy to
    Type: String

This only seems to affect LayerVersions as other resources proceed to not return the warning when using Fn::Sub in their names, even other AWS::Serverless resources.

Sample Template:

AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: SampleTemplate
Parameters:
  Environment:
    Type: String
    AllowedValues:
      - Dev
      - Qa
      - Staging
      - Mirror
      - Prod
    ConstraintDescription: You must specify a valid EnvironmentValue
    Default: Dev
    Description: Environment for to Deploy to
Resources:
  APICommonCodeLayer:
    Type: 'AWS::Serverless::LayerVersion'
    Properties:
      Description: API common libraries
      LayerName: 
        Fn::Sub: 'api-common-code-layer-${Environment}'
      ContentUri: api/common
      CompatibleRuntimes:
        - nodejs8.10
      RetentionPolicy: Retain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants