# Variables from external file - output file generated by terraform

**URL:** <https://forum.serverless.com/t/variables-from-external-file-output-file-generated-by-terraform/3229>\
**Category:** Serverless Framework\
**Created:** [December 2, 2017, 1:26pm UTC](https://forum.serverless.com/t/variables-from-external-file-output-file-generated-by-terraform/3229 "2017-12-02T13:26:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkoth](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@dkoth](https://forum.serverless.com/u/dkoth)\
**Post date:** [December 2, 2017, 1:26pm UTC](https://forum.serverless.com/t/variables-from-external-file-output-file-generated-by-terraform/3229/1 "2017-12-02T13:26:12Z")

</div>

Hi All,

I am trying to use variables from external file, which is generated by terraform. I am loading the file into variable in `custom` section as below.

```
custom:
  tfconfig: ${file(./tfconfig.json)}

```

I require the file to be dynamically created during deployment. So, I wrote a plugin which is running terraform output and generating the file. But, I get the following error

`A valid file to satisfy the declaration 'file(tfconfig.json):variable' could not be found.`

I am not sure, which hook should I use, so the file is generated, before serverless is trying to load the file. Or is there any other way to do it? Any suggestion would be helpful…

Thanks

---

<div class="post-metadata">

**Author:** ![zaknuces](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/zaknuces/32/2832_2.png) [@zaknuces](https://forum.serverless.com/u/zaknuces)\
**Post date:** [December 7, 2018, 4:32pm UTC](https://forum.serverless.com/t/variables-from-external-file-output-file-generated-by-terraform/3229/2 "2018-12-07T16:32:31Z")

</div>

Any updates on this problem. I am facing similar issue with kms plugin
