-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,33 @@ | ||
# sops-secretsmanager-cdk | ||
Safely load secrets from sops into secretsmanager using the CDK | ||
|
||
## Usage | ||
|
||
```typescript | ||
import { SopsSecretsManager } from 'sops-secretsmanager-cdk'; | ||
... | ||
new SopsSecretsManager(this, 'StoreSecrets', { | ||
asset: new s3Assets.Asset(this, 'SopsAsset', { | ||
path: './path/to/secretsfile.yaml', | ||
}), | ||
kmsKey: myKey, // or use kms.Key.fromKeyArn | ||
secretName: 'TestSecret', // or secret: mySecret | ||
mappings: { | ||
nameInSecretsManager: { | ||
path: ['path', 'to', 'value', 'in', 'secretsfile'], | ||
// optionally pass encoding: 'json' to pass a portion of the secrets file | ||
}, | ||
anotherThingInSecretsManager: { | ||
path: ['other', 'path'], | ||
}, | ||
// etc | ||
}, | ||
}); | ||
``` | ||
|
||
## Implementation | ||
|
||
Using the CDK's custom resource mini-framework, the sops secrets file | ||
is uploaded to S3 as an asset _as is_, still encoded. The custom | ||
resource Lambda then decodes the secrets (in memory, never on disk) | ||
and puts them into the SecretsManager secret. |