Issue in VM tagging in Vmware

I am trying to create VM and add a tag to that vm in Vmware using terraform and azure devops pipeline.

In 1st run of pipeline, the build success but vm is created without tag.

If i run the pipeline 2nd time without doing anything the vm which gets created contains the tag this time.

Someone kindly help