Template file in local

Before this time I used template in datastore. Can I upload my template into server via terraform?

You can upload files using file provisioner.

Before your link, I used vsphere_file resourece at : Terraform Registry But vsphere doesn’t know it as template. By the way, I use vmware not AWS.

Unfortunately VMWare vSphere lacks some of the features I’d typically recommend using to solve this problem on Cloud platforms. In particular, I believe it lacks a “metadata service” through which we can pass data from Terraform into the VM using the management control plane, which is how users of cloud platforms can pass data to software like cloud-init to handle boot-time tasks.

The Terraform docs on this subject suggest that the closest equivalent in vSphere is to attach a virtual CDROM using an ISO file containing a file named user_data.txt, but that seems difficult to orchestrate for truly dynamic data

In this case then, a provisioner may well be the best available option. Although provisioners are a last resort, I don’t know if any better alternative for a platform which lacks something equivalent to a metadata service.