Skip to content

AutoPublishAlias not accepting !If and conditions #1154

@angustohrallegrinski

Description

@angustohrallegrinski

I'm trying to create a SAM template to use in multiple development stages.
In some stages, I have to use AutoPublishAlias (production stages); in other stages (like development or test) I don't need and I don't whant AutoPublishAlias.

But, if I use conditions to set the property

Parameters:
  DeployStack:
      Type: String

Conditions: 
  CreateProdResources: !Equals [ !Ref DeployStack, 'prod' ]

AutoPublishAlias: !If [CreateProdResources, !Ref DeployStack, !Ref AWS::NoValue]

, I have this error:

Resource with id [HelloWorldFunction] is invalid. Alias name is required to create an alias

My solution for now is to use two different SAM files, but in this project we plan to have from 40 to 60 lambda functions and can be hard to maitain.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions