Skip to content

Commit 33d7382

Browse files
authored
Merge pull request #2043 from brefphp/update-secrets-documentation
Improve the documentation for creating secrets
2 parents ed80321 + 6d31ec1 commit 33d7382

File tree

2 files changed

+30
-13
lines changed

2 files changed

+30
-13
lines changed
11.3 KB
Loading

docs/environment/variables.mdx

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Callout } from 'nextra/components';
1+
import { Callout, Tab, Tabs } from 'nextra/components';
22
import { NextSeo } from 'next-seo';
33

44
<NextSeo description="Define environment variables for your Bref application." />
@@ -42,25 +42,42 @@ Instead, you can use the [SSM parameter store](https://docs.aws.amazon.com/syste
4242

4343
### Creating secrets
4444

45-
To create a parameter, you can do it via the [AWS SSM console](https://console.aws.amazon.com/systems-manager/parameters) or the [Bref Dashboard](https://dashboard.bref.sh/):
45+
<Tabs items={['Bref Cloud', 'Serverless CLI']}>
46+
<Tab>
47+
Create secrets via [Bref Cloud](https://bref.cloud).
4648

47-
![](./variables-create-secret.png)
49+
If you have **not** deployed the application yet, go to the root "Secrets" section in Bref Cloud and create a new secret there ([bref.cloud/secrets/create](https://bref.cloud/secrets/create)). Provide the target application and environment name when creating the secret.
4850

49-
You can also do it in the CLI via the following command:
51+
If you have already deployed the application, open the application in Bref Cloud, go to a specific environment, and create a new secret under the "Secrets" tab:
5052

51-
```bash
52-
aws ssm put-parameter --region us-east-1 --name '/my-app/my-parameter' --type String --value 'mysecretvalue'
53-
```
53+
![](./variables-create-secret.png)
5454

55-
On Windows, the first part of the path needs to be double slashes and all subsequent forward slashes changed to backslashes:
55+
You can also run the `bref secret:create` command in your terminal:
5656

57-
```bash
58-
aws ssm put-parameter --region us-east-1 --name '//my-app\my-parameter' --type String --value 'mysecretvalue'
59-
```
57+
```bash
58+
bref secret:create
59+
```
60+
61+
You can also run the command outside of a project: `bref secret:create --app=app-name --env=env-name --team=team-slug`.
62+
</Tab>
63+
<Tab>
64+
Create a parameter via the [AWS SSM console](https://console.aws.amazon.com/systems-manager/parameters) or the `aws` CLI:
65+
66+
```bash
67+
aws ssm put-parameter --region us-east-1 --name '/my-app/my-parameter' --type String --value 'mysecretvalue'
68+
```
69+
70+
On Windows, the first part of the path needs to be double slashes and all subsequent forward slashes changed to backslashes:
71+
72+
```bash
73+
aws ssm put-parameter --region us-east-1 --name '//my-app\my-parameter' --type String --value 'mysecretvalue'
74+
```
6075

61-
It is recommended to prefix the parameter name with your application name, for example: `/my-app/my-parameter`.
76+
It is recommended to prefix the parameter name with your application name, for example: `/my-app/my-parameter`.
6277

63-
SSM also allows to store a SecureString parameter, which is encrypted with AWS KMS. To use a SecureString, simply change the `--type` argument to `--type SecureString`. Bref takes care of decrypting the value.
78+
SSM also allows to store a SecureString parameter, which is encrypted with AWS KMS. To use a SecureString, simply change the `--type` argument to `--type SecureString`. Bref takes care of decrypting the value.
79+
</Tab>
80+
</Tabs>
6481

6582
### Retrieving secrets
6683

0 commit comments

Comments
 (0)