spring-cloud-aws
spring-cloud-aws copied to clipboard
Load rotated secrets
Is your feature request related to a problem? Please describe. I'm not sure if this is a missing feature or missing documentation. I do not see properties updated when a secret is rotated.
Describe the solution you'd like Either documentation explaining how to set this up, or the feature to pull updated values and refresh the context.
Describe alternatives you've considered Using my own implementation.
Additional context I have not tried with Parameter Store, but I would have the same exceptions. If a value is changed, that is reflected on the spring application.
Hi @marcuslange, you are right. Similar to ParameterStore (#421) there is currently no support for refreshing context when values change. I am not sure yet if it makes sense to add it to current implementation or we should rather provide Spring Cloud Config integration for SSM and ParameterStore.
Maybe https://github.com/spring-cloud/spring-cloud-aws/issues/601 is kind of related.
I currently have tested this
@RefreshScope
@RestController
public class HelloRestController {
@Value("${hello.secretmessage}")
private String hello;
@GetMapping("/hello/{name}")
public String hello(@PathVariable String name) {
return this.hello + " " + name;
}
}
- Create
aws secretsmanager create-secret --name "/secret/application" --secret-string '{"hello.secretmessage":"Hello"}'
- Start application
- See
Hello
- Update
aws secretsmanager update-secret --secret-id /secret/application --secret-string '{"hello.secretmessage":"Hola"}'
- Perform
curl -X POST http://localhost:8080/actuator/refresh
- See "Hola"
Make sure you have spring-boot-starter-actuator
dependency and the following property management.endpoints.web.exposure.include=refresh
.
I am not sure yet if it makes sense to add it to current implementation or we should rather provide Spring Cloud Config integration for SSM and ParameterStore.
Any more thoughts on it @maciejwalkowiak?