Vault Agent - Optional Secrets

I was looking at the vault agent template documentation and check ways to avoid the agent failing when a secret is not present in vault. I haven’t find any option. Actually here it says: The templating engine will always error if a secret is missing

What about cases where secrets are optional? Let’s say the app is configured to access several resources but in some environments the access to resource X (and the its secret resolution) is not need?

P.S. In the template stanza I’m using the contents parameter

The way I have managed this in the past is to have different paths for different environments, and different applications so only the secret values they need are present.

I have also managed unneeded secrets in my deployment process, whether the underlying infra, or app specific and discard (or shred if written to disk) any unused secrets.