Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
fix(secret): fix SSM parameter store code
Browse files Browse the repository at this point in the history
  • Loading branch information
maxtacu authored and jxpearce-godaddy committed Jul 17, 2019
1 parent 93f01a4 commit e5e635f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ Add your secret data to your backend. For example, AWS Secrets Manager:
aws secretsmanager create-secret --name hello-service/password --secret-string "1234"
```

AWS Parameter Store:

```
aws ssm put-parameter --name "/hello-service/password" --type "String" --value "1234"
```

and then create a `hello-service-external-secret.yml` file:

```yml
Expand All @@ -106,6 +112,18 @@ secretDescriptor:
- key: hello-service/password
name: password
```
or
```yml
apiVersion: 'kubernetes-client.io/v1'
kind: ExternalSecret
metadata:
name: hello-service
secretDescriptor:
backendType: systemManager
data:
- key: /hello-service/password
name: password
```
Save the file and run:
Expand Down
9 changes: 9 additions & 0 deletions examples/ssm-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: 'kubernetes-client.io/v1'
kind: ExternalSecret
metadata:
name: ssm-secret-key
secretDescriptor:
backendType: systemManager
data:
- key: /path/variable-name
name: variable-name
2 changes: 1 addition & 1 deletion lib/backends/system-manager-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SystemManagerBackend extends KVBackend {
WithDecryption: true
})
.promise()
return data.Value
return data.Parameter.Value
}
}

Expand Down
4 changes: 3 additions & 1 deletion lib/backends/system-manager-backend.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ describe('SystemManagerBackend', () => {

it('returns secret property value', async () => {
getParameterPromise.promise.resolves({
Value: 'fakeSecretPropertyValue'
Parameter: {
Value: 'fakeSecretPropertyValue'
}
})

const secretPropertyValue = await systemManagerBackend._get({
Expand Down

0 comments on commit e5e635f

Please sign in to comment.