Integration with AWS Secrets Manager (#1638)

EnvironmentRepository for AWS Secrets Manager

Co-authored-by: Tejas Pandilwar <tejas.pandilwar@gs.com>
Co-authored-by: Spencer Gibb <sgibb@pivotal.io>
This commit is contained in:
tejas-pandilwar
2021-07-27 13:23:47 -07:00
committed by GitHub
parent b62216d814
commit 523caa83f9
8 changed files with 1383 additions and 9 deletions

View File

@@ -802,6 +802,38 @@ credhub set --name "/my-app/default/master/more-shared" --type=json
value: {"shared.word1": "hello", "shared.word2": "world"}
----
==== AWS Secrets Manager
When using AWS Secrets Manager as a backend, you can share configuration with all applications by placing configuration in `/application/` or by placing it in the `default` profile for the application.
For example, if you add secrets with the following keys, all application using the config server will have the properties `shared.foo` and `shared.bar` available to them:
[source]
----
secret name = /secret/application-default/
----
[source,json]
----
secret value =
{
shared.foo: foo,
shared.bar: bar
}
----
or
[source]
----
secret name = /secret/application/
----
[source,json]
----
secret value =
{
shared.foo: foo,
shared.bar: bar
}
----
----
==== JDBC Backend
Spring Cloud Config Server supports JDBC (relational database) as a backend for configuration properties.
@@ -900,6 +932,46 @@ Configuration files are stored in your bucket as `{application}-{profile}.proper
NOTE: When no profile is specified `default` will be used.
==== AWS Secrets Manager Backend
Spring Cloud Config Server supports link:https://aws.amazon.com/secrets-manager/[AWS Secrets Manager] as a backend for configuration properties.
You can enable this feature by adding a dependency to link:https://github.com/aws/aws-sdk-java/tree/master/aws-java-sdk-secretsmanager[AWS Java SDK for Secrets Manager].
[source,xml,indent=0]
.pom.xml
----
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-secretsmanager</artifactId>
</dependency>
----
The following configuration uses the AWS Secrets Manager client to access secrets.
[source,yaml]
----
spring:
profiles:
active: awssecretsmanager
cloud:
config:
server:
aws-secretsmanager:
region: us-east-1
endpoint: https://us-east-1.console.aws.amazon.com/
origin: aws:secrets:
prefix: /secret/foo
profileSeparator: _
----
AWS Secrets Manager API credentials are determined using link:https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html#credentials-default[Default Credential Provider Chain].
[NOTE]
====
- When no application is specified `application` is the default, and when no profile is specified `default` is used.
====
==== CredHub Backend
Spring Cloud Config Server supports link:https://docs.cloudfoundry.org/credhub[CredHub] as a backend for configuration properties.