Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const (
SettingWorkspaceProfile SettingName = "bb.workspace.profile"
// SettingWorkspaceExternalApproval is the setting name for workspace external approval config.
SettingWorkspaceExternalApproval SettingName = "bb.workspace.approval.external"
// SettingDataClassification is the setting name for data classification.
SettingDataClassification SettingName = "bb.workspace.data-classification"
)

// RiskLevel is the approval risk level.
Expand Down
34 changes: 34 additions & 0 deletions docs/data-sources/setting.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The setting data source.

### Optional

- `classification` (Block List, Max: 1) Classification for data masking. Require ENTERPRISE subscription. (see [below for nested schema](#nestedblock--classification))
- `workspace_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--workspace_profile))

### Read-Only
Expand All @@ -29,6 +30,39 @@ The setting data source.
- `external_approval_nodes` (Block List) Configure external nodes in the approval flow. Require ENTERPRISE subscription. (see [below for nested schema](#nestedblock--external_approval_nodes))
- `id` (String) The ID of this resource.

<a id="nestedblock--classification"></a>
### Nested Schema for `classification`

Optional:

- `classification_from_config` (Boolean) If true, we will only store the classification in the config. Otherwise we will get the classification from table/column comment, and write back to the schema metadata.
- `classifications` (Block List) (see [below for nested schema](#nestedblock--classification--classifications))
- `id` (String) The classification unique uuid.
- `levels` (Block List) (see [below for nested schema](#nestedblock--classification--levels))
- `title` (String) The classification title. Optional.

<a id="nestedblock--classification--classifications"></a>
### Nested Schema for `classification.classifications`

Optional:

- `description` (String) The classification description.
- `id` (String) The classification unique id, must in {number}-{number} format.
- `level` (String) The classification level id.
- `title` (String) The classification title.


<a id="nestedblock--classification--levels"></a>
### Nested Schema for `classification.levels`

Optional:

- `description` (String) The classification level description.
- `id` (String) The classification level unique uuid.
- `title` (String) The classification level title.



<a id="nestedblock--workspace_profile"></a>
### Nested Schema for `workspace_profile`

Expand Down
34 changes: 34 additions & 0 deletions docs/resources/setting.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The setting resource.
### Optional

- `approval_flow` (Block List) Configure risk level and approval flow for different tasks. Require ENTERPRISE subscription. (see [below for nested schema](#nestedblock--approval_flow))
- `classification` (Block List, Max: 1) Classification for data masking. Require ENTERPRISE subscription. (see [below for nested schema](#nestedblock--classification))
- `external_approval_nodes` (Block List) Configure external nodes in the approval flow. Require ENTERPRISE subscription. (see [below for nested schema](#nestedblock--external_approval_nodes))
- `workspace_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--workspace_profile))

Expand Down Expand Up @@ -84,6 +85,39 @@ Optional:



<a id="nestedblock--classification"></a>
### Nested Schema for `classification`

Optional:

- `classification_from_config` (Boolean) If true, we will only store the classification in the config. Otherwise we will get the classification from table/column comment, and write back to the schema metadata.
- `classifications` (Block List) (see [below for nested schema](#nestedblock--classification--classifications))
- `id` (String) The classification unique uuid.
- `levels` (Block List) (see [below for nested schema](#nestedblock--classification--levels))
- `title` (String) The classification title. Optional.

<a id="nestedblock--classification--classifications"></a>
### Nested Schema for `classification.classifications`

Optional:

- `description` (String) The classification description.
- `id` (String) The classification unique id, must in {number}-{number} format.
- `level` (String) The classification level id.
- `title` (String) The classification title.


<a id="nestedblock--classification--levels"></a>
### Nested Schema for `classification.levels`

Optional:

- `description` (String) The classification level description.
- `id` (String) The classification level unique uuid.
- `title` (String) The classification level title.



<a id="nestedblock--external_approval_nodes"></a>
### Nested Schema for `external_approval_nodes`

Expand Down
2 changes: 1 addition & 1 deletion examples/database/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
terraform {
required_providers {
bytebase = {
version = "1.0.6"
version = "1.0.7"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/environments/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
terraform {
required_providers {
bytebase = {
version = "1.0.6"
version = "1.0.7"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/groups/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "1.0.6"
version = "1.0.7"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/instances/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
terraform {
required_providers {
bytebase = {
version = "1.0.6"
version = "1.0.7"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/policies/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "1.0.6"
version = "1.0.7"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/projects/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
terraform {
required_providers {
bytebase = {
version = "1.0.6"
version = "1.0.7"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
10 changes: 9 additions & 1 deletion examples/settings/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "1.0.6"
version = "1.0.7"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down Expand Up @@ -29,6 +29,10 @@ data "bytebase_setting" "workspace_profile" {
name = "bb.workspace.profile"
}

data "bytebase_setting" "classification" {
name = "bb.workspace.data-classification"
}

output "approval_flow" {
value = data.bytebase_setting.approval_flow
}
Expand All @@ -40,3 +44,7 @@ output "external_approval" {
output "workspace_profile" {
value = data.bytebase_setting.workspace_profile
}

output "classification" {
value = data.bytebase_setting.classification
}
55 changes: 49 additions & 6 deletions examples/setup/data_masking.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,49 @@
resource "bytebase_setting" "classification" {
name = "bb.workspace.data-classification"

classification {
id = "unique-id"
title = "Classification Example"

levels {
id = "1"
title = "Level 1"
}
levels {
id = "2"
title = "Level 2"
}

classifications {
id = "1"
title = "Basic"
}
classifications {
id = "1-1"
title = "User basic info"
level = "2"
}
classifications {
id = "1-2"
title = "User contact info"
level = "2"
}
classifications {
id = "2"
title = "Relationship"
}
classifications {
id = "2-1"
title = "Social info"
level = "2"
}
}
}

resource "bytebase_database_catalog" "employee_catalog" {
depends_on = [
bytebase_instance.test
bytebase_instance.test,
bytebase_setting.classification
]

database = "instances/test-sample-instance/databases/employee"
Expand All @@ -9,13 +52,13 @@ resource "bytebase_database_catalog" "employee_catalog" {
tables {
name = "salary"
columns {
name = "amount"
semantic_type = "default"
classification = "1-1-1"
name = "amount"
semantic_type = "default"
}
columns {
name = "emp_no"
semantic_type = "default-partial"
name = "emp_no"
semantic_type = "default-partial"
classification = "1-1"
labels = {
tenant = "example"
region = "asia"
Expand Down
2 changes: 1 addition & 1 deletion examples/setup/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "1.0.6"
version = "1.0.7"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/users/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "1.0.6"
version = "1.0.7"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/vcs/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
bytebase = {
version = "1.0.6"
version = "1.0.7"
# For local development, please use "terraform.local/bytebase/bytebase" instead
source = "registry.terraform.io/bytebase/bytebase"
}
Expand Down
Loading
Loading