Kcadm.sh hanging in a script

Hi,

I am upgrading a keycloak environment I created in terraform from v11 to v18.02 (I have other issues in newer versions, but not relevant here). If I run my commands manually (i.e. cut and paste my script) it all works fine. But when I run this as a script through terraform, kcadm.sh config credentials hangs. Is there anything different I need to do to run this in a script? Is there a command line option 'm missing?

Here is what I see from grep:

[root@KEYCLOAK20-94884a ~]# ps -ugx|grep kcadm.sh
root     11249  0.0  0.0 222488  3044 pts/0    T    00:11   0:00 /bin/sh ./kcadm.sh config credentials --server https://KEYCLOAK20-94884a.poc.com:4993 --realm master --user boss --password Secret12345
root     11913  0.0  0.0 221900  1084 pts/1    S+   00:19   0:00 grep --color=auto kcadm.sh
[root@KEYCLOAK20-94884a ~]#

I can’t explain why, but after adding a couple of echo statements and ‘java -version’ to try and trace the issue further, it’s working fine.

I wonder if it could be a first-run issue for java?