4

looking for some advice on using spring-cloud-starter-aws-secrets-manager-config 2.4.1 with spring-boot 2.6.8 .

Been trying various things without success so any hits, advice or links to examples would be great.

Added spring-cloud-starter-aws-secrets-manager-config and gson as dependencies to my spring-boot project.

Then added this to my application.yaml

spring:
  config:
    import: optional:aws-secretsmanager:/secret/kube-ns/service-name/test-secret   # Is this correct or is it relative to aws.secretsmanager.* config?
    use-legacy-processing: true # Without this I my other config is not loaded at all... unsure if this cause problems

In AWS I create a secret named /secret/kube-ns/service-name/test-secret with two key value pairs (key1=value1 and key2=value2)

In my code I try test to see if they are injected via this in a @Configuration class

@Value("${key1:not-set}")
private String key1;

@Value("${key2:not-set}")
private String key2;

@Bean testingMap(){
  log.info("key1:{}, key2:{}", key1, key2);
  return Map.of("key1", key1, "key2", key2);
}

In my logs I see values not being set as key1:not-set, key2:not-set

Edit: Figured it out and if anyone stumbles up-on this question I've made some notes here https://github.com/micke-a/spring-aws-secrets-testing

Thanks, Mike

Micke
  • 106
  • 3
  • 8
  • 1
    If you think solution you found has value for future readers, you can always post it as answer (to your own question). – rkosegi Jul 05 '22 at 19:06

0 Answers0