mirror of
https://github.com/hanzoai/kms.git
synced 2026-11-03 01:10:24 +00:00
- Fix 381 files where branding script corrupted variable names (e.g. isHanzo KMSTemplate -> isKmsTemplate) - Rebrand from "Hanzo KMS" to just "KMS" for white-label support (allows Lux KMS, Hanzo KMS, etc. via configuration) - 856 files, purely string replacements, no logic changes
166 lines
6.8 KiB
Plaintext
166 lines
6.8 KiB
Plaintext
---
|
|
title: "DBT Service Token"
|
|
description: "Learn how to automatically rotate DBT Service Tokens."
|
|
---
|
|
|
|
<Note>
|
|
**Rotation Type: Dual-Phase**
|
|
|
|
This rotation maintains two active credential sets with overlapping validity, ensuring zero-downtime during rotation cycles.
|
|
</Note>
|
|
|
|
## Prerequisites
|
|
|
|
- Create a [DBT Connection](/integrations/app-connections/dbt).
|
|
|
|
## Create a DBT Service Token Rotation in KMS
|
|
|
|
<Tabs>
|
|
<Tab title="KMS UI">
|
|
1. Navigate to your Secret Manager Project's Dashboard and select **Add Secret Rotation** from the actions dropdown.
|
|
|
|

|
|
|
|
2. Select the **DBT Service Token** option.
|
|
|
|

|
|
|
|
3. Configure the rotation behavior, then click **Next**.
|
|
|
|

|
|
|
|
- **DBT Connection** - the connection that will perform the rotation of the specified service token.
|
|
- **Rotation Interval** - the interval, in days, that once elapsed will trigger a rotation.
|
|
- **Rotate At** - the local time of day when rotation should occur once the interval has elapsed.
|
|
- **Auto-Rotation Enabled** - whether secrets should automatically be rotated once the rotation interval has elapsed. Disable this option to manually rotate secrets or pause secret rotation.
|
|
|
|
<Note>
|
|
Note that it's important that the DBT connection being used has permissions to create service tokens. Groups such as `Owner` or `Security Admin` are sufficient.
|
|
</Note>
|
|
|
|
4. Select the parameters for the DBT service token rotation. Then click **Next**.
|
|
- **Service Token Name**: The name of the service token to be created.
|
|
- **Permission Grants**: The permission grants to apply to the service token.
|
|
- **Permission Set**: The permission set to apply to the service token.
|
|
- **Projects**: The projects to apply the permission set to. Select "All Projects" for the permission set to be applied to all projects.
|
|
|
|
|
|

|
|
|
|
5. Specify the secret names that the service token should be mapped to. Then click **Next**.
|
|
|
|

|
|
|
|
- **Service Token** - the name of the secret that the service token will be mapped to.
|
|
|
|
6. Give your rotation a name and description (optional). Then click **Next**.
|
|
|
|

|
|
|
|
- **Name** - the name of the secret rotation configuration. Must be slug-friendly.
|
|
- **Description** (optional) - a description of this rotation configuration.
|
|
|
|
7. Review your configuration, then click **Create Secret Rotation**.
|
|
|
|

|
|
|
|
8. Your **DBT Service Token** credentials are now available for use via the mapped secrets.
|
|
|
|

|
|
</Tab>
|
|
<Tab title="API">
|
|
To create a DBT Service Token Rotation, make an API request to the [Create DBT Service Token Rotation](/api-reference/endpoints/secret-rotations/dbt-service-token/create) API endpoint.
|
|
|
|
### Sample request
|
|
|
|
```bash Request
|
|
curl --request POST \
|
|
--url https://us.kms.hanzo.ai/api/v2/secret-rotations/dbt-service-token \
|
|
--header 'Content-Type: application/json' \
|
|
--data '{
|
|
"name": "my-dbt-service-token-rotation",
|
|
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
|
"description": "my dbt service token rotation",
|
|
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
|
"environment": "dev",
|
|
"secretPath": "/",
|
|
"isAutoRotationEnabled": true,
|
|
"rotationInterval": 30,
|
|
"rotateAtUtc": {
|
|
"hours": 0,
|
|
"minutes": 0
|
|
},
|
|
"parameters": {
|
|
"tokenName": "my-service-token",
|
|
"permissionGrants": [
|
|
{
|
|
"permissionSet": "account_admin",
|
|
"projectId": "<project-id>" // leave empty for all projects
|
|
}
|
|
]
|
|
},
|
|
"secretsMapping": {
|
|
"serviceToken": "DBT_SERVICE_TOKEN"
|
|
}
|
|
}'
|
|
```
|
|
|
|
### Sample response
|
|
|
|
```bash Response
|
|
{
|
|
"secretRotation": {
|
|
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
|
"name": "my-dbt-service-token-rotation",
|
|
"description": "my dbt service token rotation",
|
|
"secretsMapping": {
|
|
"serviceToken": "DBT_SERVICE_TOKEN"
|
|
},
|
|
"isAutoRotationEnabled": true,
|
|
"activeIndex": 0,
|
|
"folderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
|
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
|
"createdAt": "2023-11-07T05:31:56Z",
|
|
"updatedAt": "2023-11-07T05:31:56Z",
|
|
"rotationInterval": 30,
|
|
"rotationStatus": "success",
|
|
"lastRotationAttemptedAt": "2023-11-07T05:31:56Z",
|
|
"lastRotatedAt": "2023-11-07T05:31:56Z",
|
|
"lastRotationJobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
|
"nextRotationAt": "2023-11-07T05:31:56Z",
|
|
"connection": {
|
|
"app": "dbt",
|
|
"name": "my-dbt-connection",
|
|
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
|
|
},
|
|
"environment": {
|
|
"slug": "dev",
|
|
"name": "Development",
|
|
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
|
|
},
|
|
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
|
"folder": {
|
|
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
|
"path": "/"
|
|
},
|
|
"rotateAtUtc": {
|
|
"hours": 0,
|
|
"minutes": 0
|
|
},
|
|
"lastRotationMessage": null,
|
|
"type": "dbt-service-token",
|
|
"parameters": {
|
|
"tokenName": "my-service-token",
|
|
"permissionGrants": [
|
|
{
|
|
"permissionSet": "account_admin",
|
|
"projectId": "<project-id>" // leave empty for all projects
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
```
|
|
</Tab>
|
|
</Tabs>
|