# Dynamic Template File

**URL:** <https://discourse.chef.io/t/dynamic-template-file/2810>\
**Category:** Chef Infra (archive)\
**Created:** [May 7, 2012, 4:15pm UTC](https://discourse.chef.io/t/dynamic-template-file/2810 "2012-05-07T16:15:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soula\_William](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@Soula\_William](https://discourse.chef.io/u/Soula_William)\
**Post date:** [May 7, 2012, 4:15pm UTC](https://discourse.chef.io/t/dynamic-template-file/2810/1 "2012-05-07T16:15:46Z")

</div>

My environment file has a config section with name, value pairs in it. I am trying to output a template of those name, value pairs by putting the below code into my erb file in chef:  
\<% @config.each do |setting| -%\>  
\<%= setting[0] %\>=\<%= setting[1] %\>  
\<%end-%\>

This works great the first time as it creates a property file with my name value pairs.

The problem is when the config section changes. I get a Permission denied error, but if I rerun the recipe then everything works and the new value is in the property file.

How can I create dynamic property files from the environment json file?

Thanks,  
Will
