# Exclude environment variables?

**URL:** <https://forum.serverless.com/t/exclude-environment-variables/10229>\
**Category:** Serverless Framework\
**Tags:** lambda\
**Created:** [January 10, 2020, 4:42pm UTC](https://forum.serverless.com/t/exclude-environment-variables/10229 "2020-01-10T16:42:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![taschmidt](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/taschmidt/32/3873_2.png) [@taschmidt](https://forum.serverless.com/u/taschmidt)\
**Post date:** [January 10, 2020, 4:42pm UTC](https://forum.serverless.com/t/exclude-environment-variables/10229/1 "2020-01-10T16:42:00Z")

</div>

I have a project with several lambdas in it. The main serverless config has multiple top-level environment variables defined under the “provider” element. It is standard serverless behavior for those env vars to cascade down to each lambda function which is, typically, the desired behavior.

However, I’m now writing a lambda that’ll be called by an existing CF distribution which (for some strange reason) can not have any env vars defined. Is there a way to disable this cascading behavior for just a single lambda?

For now, as a hacky workaround, I have a separate serverless config for just that one lambda but I don’t like it!

Thanks,  
tim

---

<div class="post-metadata">

**Author:** ![FilipPyrek](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/filippyrek/32/3920_2.png) [@FilipPyrek](https://forum.serverless.com/u/FilipPyrek)\
**Post date:** [January 24, 2020, 12:24am UTC](https://forum.serverless.com/t/exclude-environment-variables/10229/2 "2020-01-24T00:24:51Z")

</div>

> lambda that’ll be called by an existing CF distribution

IMHO I think it’s better to separate Lambda@Edge functions to separate Serverless service, because of their special constraints - as you mentioned “for some strange reason can not have any env vars defined”

---

<div class="post-metadata">

**Author:** ![taschmidt](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/taschmidt/32/3873_2.png) [@taschmidt](https://forum.serverless.com/u/taschmidt)\
**Post date:** [January 24, 2020, 7:54pm UTC](https://forum.serverless.com/t/exclude-environment-variables/10229/3 "2020-01-24T19:54:21Z")

</div>

Yeah, it ended up working out better that way anyway since I ran into more restrictions (for example, [edgelambda.amazonaws.com](http://edgelambda.amazonaws.com) needed IAM service permissions).
