Skip to content

Commit 0cd2bcd

Browse files
authored
bruin yml schema docs (#1687)
* update bruin yml ref * add bruin yml backend link * improve general description
1 parent 35903de commit 0cd2bcd

File tree

3 files changed

+157
-6
lines changed

3 files changed

+157
-6
lines changed

docs/.vitepress/config.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,10 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
319319
collapsed: false,
320320
items: [
321321
{text: "Overview", link: "/secrets/overview"},
322-
{text: "Hashicorp Vault", link: "/secrets/vault"}
322+
{text: "File Backend (.bruin.yml)", link: "/secrets/bruinyml"},
323+
{text: "Hashicorp Vault", link: "/secrets/vault"},
324+
{text: "Doppler", link: "/secrets/doppler"},
325+
{text: "AWS Secrets Manager", link: "/secrets/aws-secrets-manager"},
323326
]
324327
},
325328
{

docs/getting-started/credentials.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Bruin allows you to store all of your credentials in a non-versioned file called
44

55
The `.bruin.yml` file contains a list of credentials for each connection type, as well as among different environments.
66

7+
> [!TIP]
8+
> For a complete reference of the `.bruin.yml` file structure, see the [.bruin.yml Reference](../secrets/bruinyml.md).
9+
710
Here's an example of a `.bruin.yml` file:
811

912
```yaml

docs/secrets/bruinyml.md

Lines changed: 150 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
## Using `.bruin.yml` as a Secrets Backend
1+
# .bruin.yml Reference
22

3-
The easiest secret backend you can use with Bruin is a `.bruin.yml` file. This file should sit at the root of the repository and will contain the connection details and other secrets used in your pipelines.
3+
The `.bruin.yml` file is the central configuration file for Bruin pipelines. It stores all credentials, connection details, and environment configurations needed to run your data pipelines. The file is automatically created when you run any `bruin` command the first time in a project, and it is automatically added to `.gitignore`.
44

5-
`.bruin.yml` is the default secrets backend. To use it, simply place the file at the root of your project. You can also specify a different location using the `--config-file /path/to/.bruin.yml`
5+
`.bruin.yml` file is expected to be in the root of your Git repo. You can specify a different location using the `--config-file /path/to/.bruin.yml`
66

7-
## `.bruin.yml` Schema
7+
## File Structure
88

9-
.bruin.yml contains information about your secrets and credentials organised in "environments". It also contains information about the default environment to use when none is specified. The environments contains a set of connections grouped by platform. This is an example that illustrates the schema from the [Quickstart](../getting-started/introduction/quickstart.md).
9+
The file is a YAML file with the following structure:
10+
11+
```yaml
12+
default_environment: <environment_name>
13+
environments:
14+
<environment_name>:
15+
schema_prefix: <optional_prefix>
16+
connections:
17+
<connection_type>:
18+
- name: "<connection_name>"
19+
# connection-specific fields...
20+
```
21+
22+
### Example
1023

1124
```yaml
1225
default_environment: default
@@ -22,3 +35,135 @@ environments:
2235
- "MagnusCarlsen"
2336
- "Hikaru"
2437
```
38+
39+
## Top-Level Fields
40+
41+
| Field | Type | Required | Description |
42+
|-------|------|----------|-------------|
43+
| `default_environment` | string | No | Environment to use when none is specified. Defaults to `default`. |
44+
| `environments` | map | Yes | Map of environment names to their configurations. |
45+
46+
## Environment Configuration
47+
48+
Each environment contains:
49+
50+
| Field | Type | Required | Description |
51+
|-------|------|----------|-------------|
52+
| `connections` | object | Yes | Connection definitions grouped by type. |
53+
| `schema_prefix` | string | No | Prefix added to schema names (useful for dev/staging environments). |
54+
55+
## Environment Variables
56+
57+
You can reference environment variables in your configuration using `${VAR_NAME}` syntax:
58+
59+
```yaml
60+
environments:
61+
default:
62+
connections:
63+
postgres:
64+
- name: my_postgres
65+
username: ${POSTGRES_USERNAME}
66+
password: ${POSTGRES_PASSWORD}
67+
host: ${POSTGRES_HOST}
68+
port: ${POSTGRES_PORT}
69+
database: ${POSTGRES_DATABASE}
70+
```
71+
72+
Environment variables are expanded at runtime, not when the file is parsed.
73+
74+
## Generic Credentials
75+
76+
Generic credentials are key-value pairs that can be used to inject secrets into your assets:
77+
78+
```yaml
79+
connections:
80+
generic:
81+
- name: MY_SECRET
82+
value: secretvalue
83+
```
84+
85+
Common use cases include API keys, passwords, and other secrets that don't fit a specific connection type.
86+
87+
## Connection Types
88+
89+
For the specific fields and configuration options for each connection type, refer to the dedicated documentation pages:
90+
91+
### Data Platforms
92+
93+
| Connection Type | Documentation |
94+
|----------------|---------------|
95+
| `google_cloud_platform` | [Google BigQuery](../platforms/bigquery.md) |
96+
| `snowflake` | [Snowflake](../platforms/snowflake.md) |
97+
| `postgres` | [PostgreSQL](../platforms/postgres.md) |
98+
| `redshift` | [Redshift](../platforms/redshift.md) |
99+
| `databricks` | [Databricks](../platforms/databricks.md) |
100+
| `athena` | [AWS Athena](../platforms/athena.md) |
101+
| `duckdb` | [DuckDB](../platforms/duckdb.md) |
102+
| `motherduck` | [MotherDuck](../platforms/motherduck.md) |
103+
| `clickhouse` | [ClickHouse](../platforms/clickhouse.md) |
104+
| `mysql` | [MySQL](../platforms/mysql.md) |
105+
| `mssql` | [Microsoft SQL Server](../platforms/mssql.md) |
106+
| `synapse` | [Azure Synapse](../platforms/synapse.md) |
107+
| `oracle` | [Oracle](../platforms/oracle.md) |
108+
| `trino` | [Trino](../platforms/trino.md) |
109+
| `elasticsearch` | [Elasticsearch](../platforms/elasticsearch.md) |
110+
| `mongo_atlas` | [MongoDB Atlas](../platforms/mongoatlas.md) |
111+
| `s3` | [S3](../platforms/s3.md) |
112+
| `emr_serverless` | [AWS EMR Serverless](../platforms/emr_serverless.md) |
113+
| `dataproc_serverless` | [GCP Dataproc Serverless](../platforms/dataproc_serverless.md) |
114+
115+
### Data Ingestion Sources
116+
117+
Connection schemas for ingestion sources are documented on their respective pages under [Data Ingestion](../ingestion/overview.md). Each source page includes the required `.bruin.yml` connection configuration.
118+
119+
---
120+
121+
## Complete Example
122+
123+
```yaml
124+
default_environment: default
125+
126+
environments:
127+
default:
128+
connections:
129+
google_cloud_platform:
130+
- name: "gcp-prod"
131+
project_id: "my-project"
132+
service_account_file: "credentials/gcp-service-account.json"
133+
134+
postgres:
135+
- name: "postgres-main"
136+
username: "${POSTGRES_USER}"
137+
password: "${POSTGRES_PASSWORD}"
138+
host: "db.example.com"
139+
port: 5432
140+
database: "analytics"
141+
142+
snowflake:
143+
- name: "snowflake-prod"
144+
account: "ABC12345"
145+
username: "bruin_user"
146+
private_key_path: "credentials/snowflake_key.p8"
147+
database: "ANALYTICS"
148+
warehouse: "COMPUTE_WH"
149+
150+
generic:
151+
- name: "SLACK_WEBHOOK"
152+
value: "https://hooks.slack.com/..."
153+
154+
staging:
155+
schema_prefix: "stg_"
156+
connections:
157+
google_cloud_platform:
158+
- name: "gcp-staging"
159+
project_id: "my-project-staging"
160+
use_application_default_credentials: true
161+
162+
postgres:
163+
- name: "postgres-staging"
164+
username: "staging_user"
165+
password: "${STAGING_POSTGRES_PASSWORD}"
166+
host: "staging-db.example.com"
167+
port: 5432
168+
database: "analytics"
169+
```

0 commit comments

Comments
 (0)