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.

It sounds like you’re encountering an issue where a bash script executed via Terraform’s remote-exec provisioner behaves differently than when run manually on an Ubuntu 20.04 server. This discrepancy often arises due to differences in the environment in which the script is executed. Here are some potential causes and solutions: [I will DM you]