Skip to content

Commit 9eaaf2a

Browse files
committed
feat: inject secrets
1 parent 45031fd commit 9eaaf2a

File tree

8 files changed

+4509
-2413
lines changed

8 files changed

+4509
-2413
lines changed

.github/workflows/workflow.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ on:
99
jobs:
1010
build:
1111
runs-on: ${{ matrix.os }}
12-
timeout-minutes: 30
12+
timeout-minutes: 10
1313
strategy:
1414
matrix:
1515
os: [ubuntu-latest, macOS-latest, windows-latest]
16-
node-version: [8.17.0, '*']
16+
node-version: ['12', '*']
1717
exclude:
1818
- os: macOS-latest
19-
node-version: 8.17.0
19+
node-version: '12'
2020
- os: windows-latest
21-
node-version: 8.17.0
21+
node-version: '12'
2222
fail-fast: false
2323
steps:
2424
- name: Git checkout

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ node_modules
1010
/coverage
1111
/build
1212
.vscode
13+
.env

README.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,64 @@
11
[![Build](https://github.com/netlify/netlify-plugin-secrets-manager/workflows/Build/badge.svg)](https://github.com/netlify/netlify-plugin-secrets-manager/actions)
22
[![Node](https://img.shields.io/node/v/@netlify/plugin-secrets-manager.svg?logo=node.js)](https://www.npmjs.com/package/@netlify/plugin-secrets-manager)
33

4-
# netlify-plugin-secrets-manager
4+
# Netlify Plugin Secrets Manager
55

6-
Update me!
6+
Inject secrets from AWS Secrets Manager into the Netlify build process.
7+
8+
## Prerequisites
9+
10+
- `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` set as build environment variables with proper permissions, e.g.
11+
12+
```json
13+
{
14+
"Version": "2012-10-17",
15+
"Statement": [
16+
{
17+
"Sid": "VisualEditor0",
18+
"Effect": "Allow",
19+
"Action": "secretsmanager:GetSecretValue",
20+
"Resource": "arn:aws:secretsmanager:<region>:<account-id>:secret:<secret-path>"
21+
},
22+
{
23+
"Sid": "VisualEditor1",
24+
"Effect": "Allow",
25+
"Action": "secretsmanager:ListSecrets",
26+
"Resource": "*"
27+
}
28+
]
29+
}
30+
```
31+
32+
> You can scope the `GetSecretValue` permission to a path, but the `ListSecrets` must be a wild card `*`
33+
34+
## Usage
35+
36+
You can install this plugin in the Netlify UI from this
37+
[direct in-app installation link](https://app.netlify.com/plugins/@netlify/plugin-secrets-manager/install) or from the
38+
[Plugins directory](https://app.netlify.com/plugins).
39+
40+
You can also install it manually:
41+
42+
From your project's base directory, use npm, yarn, or any other Node.js package manager to add the plugin to
43+
`devDependencies` in `package.json`.
44+
45+
```bash
46+
npm install -D @netlify/plugin-secrets-manager
47+
```
48+
49+
Then add the plugin to your `netlify.toml` configuration file:
50+
51+
```toml
52+
[[plugins]]
53+
package = "@netlify/plugin-secrets-manager"
54+
```
55+
56+
## Additional configuration
57+
58+
- By default the plugin injects the secrets with a `AWS_SECRET_` prefix. You can override the default prefix using the
59+
`AWS_SECRET_PREFIX` environment variable.
60+
- The plugin defaults to the `us-east-1` region. You can override the default region using the `AWS_DEFAULT_REGION`
61+
environment variable.
762

863
## Contributors
964

netlify.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[build]
2+
command = "echo $AWS_SECRET_SECRET_NAME"
23
publish = "public"
34
[[plugins]]
45
package = "."

0 commit comments

Comments
 (0)