Skip to content

Commit

Permalink
Usage documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
plumdog committed Feb 26, 2020
1 parent e923054 commit 0354dd4
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
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.

0 comments on commit 0354dd4

Please sign in to comment.