# Templatefile Function problem

**URL:** <https://discuss.hashicorp.com/t/templatefile-function-problem/32093>\
**Category:** Terraform\
**Created:** [November 18, 2021, 6:56am UTC](https://discuss.hashicorp.com/t/templatefile-function-problem/32093 "2021-11-18T06:56:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonmacpherson](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/simonmacpherson/32/23829_2.png) [@simonmacpherson](https://discuss.hashicorp.com/u/simonmacpherson)\
**Post date:** [November 18, 2021, 6:56am UTC](https://discuss.hashicorp.com/t/templatefile-function-problem/32093/1 "2021-11-18T06:56:12Z")

</div>

I’m using the `templatefile` Function to reference a batch script.

Syntax  
user\_data = templatefile("${path.module}/gw\_user\_data.sh", {vars}

The bash script is located in the path of the module.

Validation and plan operations complete successfully.

However the script is not being called.

Does anyone know what might be the cause?

Running Terraform v1.0.9 on Windows.

---

<div class="post-metadata">

**Author:** ![apparentlymart](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/apparentlymart/32/702_2.png) [@apparentlymart](https://discuss.hashicorp.com/u/apparentlymart)\
**Post date:** [November 18, 2021, 3:24pm UTC](https://discuss.hashicorp.com/t/templatefile-function-problem/32093/2 "2021-11-18T15:24:23Z")

</div>

Hi @simonmacpherson,

The responsibility for deciding what to do with the raw data passed in `user_data` is handled by software running in your virtual machine rather than by Terraform; Terraform is just passing the data to the API exactly as you provided it.

To debug this then you’ll need to look at the logs for whatever software in your VM image is handling `user_data`. A common choice for official Linux distribution base images is [cloud-init](https://cloudinit.readthedocs.io/en/latest/), and if you image uses it then you may find useful debug information in cloud-init’s logs, which should be in the logs directory inside you VM’s local filesystem.

---

<div class="post-metadata">

**Author:** ![simonmacpherson](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/simonmacpherson/32/23829_2.png) [@simonmacpherson](https://discuss.hashicorp.com/u/simonmacpherson)\
**Post date:** [November 18, 2021, 11:01pm UTC](https://discuss.hashicorp.com/t/templatefile-function-problem/32093/3 "2021-11-18T23:01:02Z")

</div>

Yes I understand that, I just wanted to make sure there wasn’t anything specific in my tf configuration of bug in specific tf version that could be impacting the transfer of raw data.
