Retrieve multiple aws secrete in spring boot app that have same keys

Viewed 263

Have a spring boot app (with starter parent at 2.4.8).

The app is connecting to multiple data sources, and the automated Jenkins job being used to create secrets across company does it such a way that although secrets names are different(per app/source) but they all have same value underneath - 'username' and 'password' text.

For example:

  1. first secret would be '/secret/rds/dev/foo/foo_app_user' with value:

       username : user1 
       password: pass1
    
  2. second secret would be '/secret/snowflake/dev/hoo/hoo_app_user' with value:

        username : user2
        password: pass2
    

Trying to figure out how can they both be imported using spring config import, while still being able to be used distinctively in properties/yaml file

  spring:
     config:
        import: aws secretsmanager:/secret/rds/dev/foo/foo_app_user,/secret/snowflake/dev/hoo/hoo_app_user


...
system:
  cache:
    username: ${username}
    password: ${password}



....
snowflake:
   datasource:
        username: ${username}
        password: ${password}
0 Answers
Related