Skip to content

Bug: Using a Ref in StageName is Not Working Properly - Template.yaml #3548

Closed
@Jonathynlee

Description

@Jonathynlee

Description:

In template.yaml, I am using a parameter reference for StageName. When I go to build and deploy my sam application, it is replaced with "Stage". If I pass the string in directly there are no issues.

Steps to reproduce:

create parameter

Parameters:
  Stage:   
    Type: String   
    Description: Stage Name
    Default: develop

use parameter in API Gateway creation

  ProfileAPIGateway:   
    Type: AWS::Serverless::Api   
    Properties:   
      GatewayResponses:   
        DEFAULT_4XX:   
          ResponseParameters:   
            Headers:   
              Access-Control-Allow-Origin: "'*'"   
      Name: !Ref ApisApi   
      StageName: !Ref Stage
...

Please note the "StageName: !Ref Stage"

Observed result:

The incorrect StageName is being used
image
image

Expected result:

Logical resource Ids should all have "develop" at the end, not "Stage"

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

{
"version": "1.105.0",
"system": {
"python": "3.11.4",
"os": "Windows-10-10.0.19045-SP0"
},
"additional_dependencies": {
"docker_engine": "Not available",
"aws_cdk": "Not available",
"terraform": "Not available"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/intrinsicsRef, If, Sub, GetAtt, ...blocked/close-if-inactiveBlocked for >14 days with no response, will be closed if still inactive after 7 days

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions