# Reference variables in multiple files

**URL:** <https://forum.serverless.com/t/reference-variables-in-multiple-files/3345>\
**Category:** Serverless Framework\
**Created:** [December 15, 2017, 11:23pm UTC](https://forum.serverless.com/t/reference-variables-in-multiple-files/3345 "2017-12-15T23:23:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlohbihler](https://avatars.discourse-cdn.com/v4/letter/m/90db22/32.png) [@mlohbihler](https://forum.serverless.com/u/mlohbihler)\
**Post date:** [December 15, 2017, 11:23pm UTC](https://forum.serverless.com/t/reference-variables-in-multiple-files/3345/1 "2017-12-15T23:23:48Z")

</div>

As a newb, i was thinking that i could “import” multiple files into a serverless.yml file, say like this:

```
common: ${file(../common.yml)}
custom: ${file(../.env.yml)}

```

But, only the “custom” variables work. The others show up all weird when i run `sls print`. For example:

```
provider:
  name: !<tag:yaml.org,2002:js/undefined> ''
  runtime: !<tag:yaml.org,2002:js/undefined> ''

```

Is there something special about “custom”?

---

<div class="post-metadata">

**Author:** ![bill](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/bill/32/1072_2.png) [@bill](https://forum.serverless.com/u/bill)\
**Post date:** [December 17, 2017, 8:29am UTC](https://forum.serverless.com/t/reference-variables-in-multiple-files/3345/2 "2017-12-17T08:29:37Z")

</div>

I don’t see there is the keyword named `common` in serverless framework

If you need to reference from two files, you can do this:

```
custom:
  common: ${file(../common.yml)}
  env: ${file(../.env.yml)}

```

Then you can reference those variables with (example):

```
provider:
  environment:
    comm_variable1: ${self:custom.common.comm_var1}
    env_var2: ${self:custom.env.env_var2}

```

Hope that helps.

---

<div class="post-metadata">

**Author:** ![mlohbihler](https://avatars.discourse-cdn.com/v4/letter/m/90db22/32.png) [@mlohbihler](https://forum.serverless.com/u/mlohbihler)\
**Post date:** [December 17, 2017, 6:49pm UTC](https://forum.serverless.com/t/reference-variables-in-multiple-files/3345/3 "2017-12-17T18:49:05Z")

</div>

Yes, it does. Thanks Bill. I guess my confusion is because there doesn’t seem to be any mention in the docs that “custom” is a keyword. My assumption was that i could choose whatever keys i wanted.

---

<div class="post-metadata">

**Author:** ![bill](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/bill/32/1072_2.png) [@bill](https://forum.serverless.com/u/bill)\
**Post date:** [December 17, 2017, 8:10pm UTC](https://forum.serverless.com/t/reference-variables-in-multiple-files/3345/4 "2017-12-17T20:10:28Z")

</div>

ic.

If you need to know the list of all available properties in `serverless.yml` when the provider is set to aws. Please go through this document [Serverless.ym Reference](https://serverless.com/framework/docs/providers/aws/guide/serverless.yml/)

> **[Serverless Framework - AWS Lambda Guide - Serverless.yml Reference](https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/)**
>
> The Serverless Framework documentation for AWS Lambda, API Gateway, EventBridge, DynamoDB and much more.

Interesting part is, `custom` is not in the list. Seems the document need be updated.
