Sorry to dig this up again...
I just tested this and found the same behavior with a Centos 8.4 cloud image, Ubuntu cloud image works fine.
If I just use a hostname as the VM name, the Centos VM hostname ends up as "localhost". If I use a FQDN as the VM name, then the hostname gets set properly...