Skip to content

"Enabled" field in "DeploymentPreference" for "AWS::Serverless::Function" is ignored if it is a Condition #350

@ksskarthik628

Description

@ksskarthik628

I have a SAM template with Parameters, API, and Lambda, and I have three stacks with "Stage" parameter set as "dev-user1", "alpha", or "beta". Now, I am trying to update my lambda to support traffic shifting based on what stack it is as follows:

Conditions:
  IsBetaStage:
    Fn::Equals: [Ref: Stage, beta]
  IsServiceStage:
    Fn::Or: ["Fn::Equals": [Ref: Stage, alpha], Condition: IsBetaStage]
Resources:
  LambdaFunction:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: "LambdaFunction"
      Handler: 'com.company.lambda.LambdaHandler::handleRequest'
      Runtime: java8
      Timeout: 30
      Tracing: Active
      AutoPublishAlias: live
      DeploymentPreference:
        Enabled: IsServiceStage
        Type:
          Fn::If: [IsBetaStage, Linear10PercentEvery10Minutes, AllAtOnce]
        Alarms:
          - { Ref: IncreasedFaults }
          - { Ref: IncreasedLatency }

According to the template, "Enabled" should result to false in stack with "Stage" parameter set to "dev-user1" and true in every other stack, and hence there should be no traffic shifting in this stack. But I am observing the opposite of this, i.e, I am seeing traffic shifting in the stack with "Stage" parameter set to "dev-user1"

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