-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
The idea is to build an extension (ConfigSource) to read configuration from SSM parameter store.
My question is, what is the best way to create the SSM client. As we are in the configuration phase of an application i cannot (should not) inject the ssm client.
For example. I could create the ssm client myself reusing the AwsConfig aws() like below
@ConfigMapping(prefix = "test.amazon-ssm-config")
@ConfigRoot(phase = ConfigPhase.RUN_TIME)
public interface AmazonSSMConfig {
AwsConfig aws();
......
and then create the ssmClient.
` private SsmClient createSsmClient() {
var awsConfig = this.config.aws();
var builder = SsmClient.builder();
if (awsConfig.credentials().isPresent()) {
var providerCfg = awsConfig.credentials().get();
builder.credentialsProvider(
providerCfg.type().create(providerCfg, "iapi.amazon-ssm-config.aws"));
}
awsConfig.region().ifPresent(builder::region);
return builder.build();
}`
But maybe you have suggestions on how to do this a better way and i would really like to hear them.
Metadata
Metadata
Assignees
Labels
No labels