Ideally the binary is installed somewhere where the identity it runs under has access to a keystore. That way you tons need a config file with secrets.
We have a terraform build process that is used to control deployments in different systems including Azure. That planning pipeline outputs a full terraform script which contains everything needed to build the infrastructure which of course has keys in it.
We need people to be able to see the pipeline builds but not read the data in the artifacts.
We are thinking about using a blob storage or universal artifact feed with access control as a work around but I am open to hear ideas.
Ideally most connections are made internally using the service principal identity. That way you don’t need too many connection strings and passwords or tokens. But it’s hard to ban them all.
2nd best is to put them in keyvault and again leverage the identity to access the vault.
Last resort put the in the keyvault and have terraform read the secrets from the keyvault as a data source.
Where possible, have terraform actually generate the secret and then put it in the vault, so basically nobody ever has to handle the secret manually.