Skip to content

!FindInMap does not work to set Environment Variables #476

Closed

Description

@bnegrao

Description:

I am using !FindInMap to set an environment variable value and when I run it with sam local start-api the variable is empty.

Steps to reproduce the issue:

Resources:
  HelloWorldFunction:
    Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
    Properties:
      CodeUri: hello-world/
      Handler: hello-world
      Runtime: go1.x
      Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html
      Events:
        CatchAll:
          Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
          Properties:
            Path: /hello
            Method: GET
      Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
        Variables:
          S3BUCKETURL: !FindInMap: [URLS, S3Bucket, test]              
         

Mappings:
  "URLS" : {
    "S3Bucket" : {
      "sam_local" : "http://sam_local_url",
      "test": "http://test_url",
      "prod" : "http://prod_url"
    }
  }

Observed result:
Empty string as variable value

Expected result:
S3BUCKETURL="http://test_url"

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

Output of sam --version:
SAM CLI, version 0.3.0

Activity

  1. jfuss commented on Jun 18, 2018

    @jfuss
    Contributor

    We currently do not resolve Intrinsic functions. For Environment Variables, you can use the --env-vars instead.

    Marking this as a feature-request.

  2. added this to the Backlog milestone on Jan 18, 2019
  3. added
    stage/waiting-for-release
    on Aug 14, 2019
  4. walkafwalka commented on Aug 16, 2019

    @walkafwalka

    @jfuss I noticed this was tagged as stage/waiting-for-release, is this feature supposed to be available in one of the branches right now?

  5. jfuss commented on Aug 26, 2019

    @jfuss
    Contributor

    @walkafwalka It is in the develop branch.

  6. jfuss commented on Sep 16, 2019

    @jfuss
    Contributor

    Release in v0.21.0.

    Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/lambda-invokearea/local/start-apipriority/2-importantstage/waiting-for-releasetype/feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions