Skip to content

Commit 318333f

Browse files
authored
Merge pull request #4903 from MyMirelHub/add-multipleKeyValuesPerSecret-aws-secretstore
AWS Secrets Manager multipleKeyValuesPerSecret documentation
2 parents 8c5ab7d + c17cf7e commit 318333f

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

daprdocs/content/en/reference/components-reference/supported-secret-stores/aws-secret-manager.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
type: docs
33
title: "AWS Secrets Manager"
44
linkTitle: "AWS Secrets Manager"
5-
description: Detailed information on the secret store component
5+
description: Detailed information on the AWS Secrets Manager secret store component
66
aliases:
77
- "/operations/components/setup-secret-store/supported-secret-stores/aws-secret-manager/"
88
---
@@ -30,6 +30,8 @@ spec:
3030
value: "[aws_secret_key]"
3131
- name: sessionToken
3232
value: "[aws_session_token]"
33+
- name: multipleKeyValuesPerSecret
34+
value: "false"
3335
```
3436
{{% alert title="Warning" color="warning" %}}
3537
The above example uses secrets as plain strings. It is recommended to use a local secret store such as [Kubernetes secret store]({{% ref kubernetes-secret-store.md %}}) or a [local file]({{% ref file-secret-store.md %}}) to bootstrap secure key storage.
@@ -43,6 +45,7 @@ The above example uses secrets as plain strings. It is recommended to use a loca
4345
| accessKey | Y | The AWS Access Key to access this resource | `"key"` |
4446
| secretKey | Y | The AWS Secret Access Key to access this resource | `"secretAccessKey"` |
4547
| sessionToken | N | The AWS session token to use | `"sessionToken"` |
48+
| multipleKeyValuesPerSecret | N | When set to `"true"` allows for multiple key value pairs to be stored in a single secret. Defaults to `"false"` | `"true"` |
4649
4750
{{% alert title="Important" color="warning" %}}
4851
When running the Dapr sidecar (daprd) with your application on EKS (AWS Kubernetes), if you're using a node/pod that has already been attached to an IAM policy defining access to AWS resources, you **must not** provide AWS access-key, secret-key, and tokens in the definition of the component spec you're using.
@@ -57,6 +60,46 @@ Query Parameter | Description
5760
`metadata.version_id` | Version for the given secret key.
5861
`metadata.version_stage` | Version stage for the given secret key.
5962

63+
## Configure multiple key-values per secret
64+
65+
The `multipleKeyValuesPerSecret` flag determines whether the secret store presents a single value or multiple key-value pairs per secret.
66+
67+
### Single value per secret
68+
69+
If `multipleKeyValuesPerSecret` is `false` (default), AWS Secrets Manager returns the secret value as-is. Given a secret named `database-credentials` with the following JSON content:
70+
71+
```json
72+
{
73+
"username": "admin",
74+
"password": "secret123",
75+
"host": "db.example.com"
76+
}
77+
```
78+
79+
Requesting this secret returns the entire JSON as a single value:
80+
81+
```bash
82+
$ curl http://localhost:3500/v1.0/secrets/awssecretmanager/database-credentials
83+
{
84+
"database-credentials": "{\"username\":\"admin\",\"password\":\"secret123\",\"host\":\"db.example.com\"}"
85+
}
86+
```
87+
88+
### Multiple key-value pairs per secret
89+
90+
If `multipleKeyValuesPerSecret` is `true`, the secret store parses JSON content stored in AWS Secrets Manager and returns it as multiple key-value pairs.
91+
92+
Requesting the same `database-credentials` secret from above, the response breaks the JSON object into its own entries, allowing it to be parsed into multiple key-value pairs.
93+
94+
```bash
95+
$ curl http://localhost:3500/v1.0/secrets/awssecretmanager/database-credentials
96+
{
97+
"username": "admin",
98+
"password": "secret123",
99+
"host": "db.example.com"
100+
}
101+
```
102+
60103
## Create an AWS Secrets Manager instance
61104

62105
Setup AWS Secrets Manager using the AWS documentation: https://docs.aws.amazon.com/secretsmanager/latest/userguide/tutorials_basic.html.

daprdocs/data/components/secret_stores/aws.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
state: Beta
44
version: v1
55
since: "1.15"
6+
features:
7+
multipleKeyValuesPerSecret: true
68
- component: AWS SSM Parameter Store
79
link: aws-parameter-store
810
state: Alpha

0 commit comments

Comments
 (0)