Merge pull request #2005 from fivepapertigers/feature/lambda-env-mapping
Lambda Cloudformation Env Variables
This commit is contained in:
commit
850496f29a
@ -386,7 +386,7 @@ class LambdaFunction(BaseModel):
|
|||||||
'Role': properties['Role'],
|
'Role': properties['Role'],
|
||||||
'Runtime': properties['Runtime'],
|
'Runtime': properties['Runtime'],
|
||||||
}
|
}
|
||||||
optional_properties = 'Description MemorySize Publish Timeout VpcConfig'.split()
|
optional_properties = 'Description MemorySize Publish Timeout VpcConfig Environment'.split()
|
||||||
# NOTE: Not doing `properties.get(k, DEFAULT)` to avoid duplicating the
|
# NOTE: Not doing `properties.get(k, DEFAULT)` to avoid duplicating the
|
||||||
# default logic
|
# default logic
|
||||||
for prop in optional_properties:
|
for prop in optional_properties:
|
||||||
|
@ -1952,7 +1952,12 @@ def lambda_handler(event, context):
|
|||||||
"Description": "Test function",
|
"Description": "Test function",
|
||||||
"MemorySize": 128,
|
"MemorySize": 128,
|
||||||
"Role": "test-role",
|
"Role": "test-role",
|
||||||
"Runtime": "python2.7"
|
"Runtime": "python2.7",
|
||||||
|
"Environment": {
|
||||||
|
"Variables": {
|
||||||
|
"TEST_ENV_KEY": "test-env-val",
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1973,6 +1978,9 @@ def lambda_handler(event, context):
|
|||||||
result['Functions'][0]['MemorySize'].should.equal(128)
|
result['Functions'][0]['MemorySize'].should.equal(128)
|
||||||
result['Functions'][0]['Role'].should.equal('test-role')
|
result['Functions'][0]['Role'].should.equal('test-role')
|
||||||
result['Functions'][0]['Runtime'].should.equal('python2.7')
|
result['Functions'][0]['Runtime'].should.equal('python2.7')
|
||||||
|
result['Functions'][0]['Environment'].should.equal({
|
||||||
|
"Variables": {"TEST_ENV_KEY": "test-env-val"}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
@mock_cloudformation
|
@mock_cloudformation
|
||||||
|
Loading…
Reference in New Issue
Block a user