This bundle will help you to retrieve secrets from GCP Secret Manager on runtime. Define this service within your Symfony services.yaml by adding the following:
Rauchfussio\GCPSecretManagerEnvVarProcessor\:
resource: '../vendor/rauchfuss-io/gcpsecretmanager-envvarprocessor/src/*'
tags: ['container.env_var_processor']
arguments:
$gcpProjectId: 'YOUR GCP PROJECTID'
$gcpCredentialsFile: 'YOUR SERVICE ACCOUNT PRIVATE KEY'
Now you can define which secrets you want to request on runtime:
App\Controller\DefaultController:
class: 'App\Controller\DefaultController'
arguments:
$secret: '%env(string:gcpsecretmanager:YOURSECRET)%'
- Require the bundle with composer:
composer require rauchfuss-io/gcpsecretmanager-envvarprocessor