This syntax error appears because you have written a quoted string that has other un-escaped quote marks inside it, and so Terraform thinks "file (" is the entire value of template and doesn’t understand what to do with the rest of the line d:\vcsa100_vCSA_on_ESXi.json")".
The correct syntax for calling the file function would be to not have it in quotes at all. Also, in Terraform we typically use forward slashes in all paths by convention, and use paths relative to the current module so that the module can be portable to other computers that might run different operating systems:
With that said, I think it’s also worth noting tha the template_file data source is deprecated and continues to be supported only for backward compatibility with Terraform v0.11 and earlier. Terraform now has a built-in function templatefile which replaces most of the functionality of the template_file data source directly within the Terraform language, without the need for an external plugin.
To use it, you can replace your data "template_file" "task" block with a named local value like this:
In the example you shared you didn’t include any template variables in template_file, so I mimicked that here by passing an empty object as the second argument to templatefile. Rendering a template without any dynamic data is unusual but valid. If you do intend to use data from elsewhere in your module within the template you can add attributes to that object: