There exist several issues about wanting to access connection details for instance testing etc. (at least #3331 #3889 #4173) which are all closed and locked.
Meanwhile, the needed connection informations (Host=IP, Port, User, Password...) are available to provisioners: https://developer.hashicorp.com/packer/docs/templates/hcl_templates/contextual-variables.
Please add comments to these issues pointing to the up to date documentation so the infos get found when doing an internet search.