Remote-exec provisioner do not execute bash scripts correctly?

I confused with problem. I have very simple script which is deployed to Ubuntu 20.4 server in the same network. When that script run manually, it do two simple things - display value of $HADOOP_HOME variable and run ‘hadoop version’ command. Linux user and permission the same. all works fine from /tmp dir. However, when the same script run by terraform, it return empty variable value and tell "command not found’ for ‘hadoop version’ command. I can’t understand why this happened and how to fix.