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

Does the tag already exists or is it being created in the same plan? If so, there would be a dependency that would need to be set with depends_on.