Templatefile Function problem

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.

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, 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.

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.