Hi @rawvarun ,
Try below steps:
1. Create a Template YAML File
This file contains a placeholder for the environment variable.
File: splunk.template.yaml
splunk:
hec_token: ${SPLUNK_TOKEN}
hec_url: https://splunk-instance:8088/services/collector
2. Define the Environment Variable
In Adobe Cloud Manager:
Go to Cloud Manager UI => your Pipeline => Edit Variables
Add a variable:
- Name: SPLUNK_TOKEN
- Value: your actual HEC token
- Mark it as secret (this keeps it hidden and secure)
3. Replace Placeholders During Build
In your Cloud Manager pipeline, you can add a custom script step using a shell script to perform substitution.
Script: replace-vars.sh
#!/bin/sh
# Replace environment variables in YAML template
envsubst < splunk.template.yaml > splunk.yaml
Ensure this script is executable:
chmod +x replace-vars.sh
4. Add Script Execution in Build
In your build process (e.g., Maven or CI/CD tool), run the script before your service reads the YAML.
If you're using Cloud Manager, you can do this in your build.sh or include as a build hook.
./replace-vars.sh
This file now contains real, secure values injected at runtime, and never stores secrets in Git:
splunk:
hec_token: abc123-real-token
hec_url: https://splunk-instance:8088/services/collector
Regards,
Amit