Skip to content

Commit 5596057

Browse files
committed
chore: update examples
1 parent d37b4ee commit 5596057

File tree

11 files changed

+221
-275
lines changed

11 files changed

+221
-275
lines changed

examples/environments/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
terraform {
33
required_providers {
44
bytebase = {
5-
version = "1.0.3"
5+
version = "1.0.5"
66
# For local development, please use "terraform.local/bytebase/bytebase" instead
77
source = "registry.terraform.io/bytebase/bytebase"
88
}

examples/instances/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
terraform {
33
required_providers {
44
bytebase = {
5-
version = "1.0.3"
5+
version = "1.0.5"
66
# For local development, please use "terraform.local/bytebase/bytebase" instead
77
source = "registry.terraform.io/bytebase/bytebase"
88
}

examples/projects/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
terraform {
33
required_providers {
44
bytebase = {
5-
version = "1.0.3"
5+
version = "1.0.5"
66
# For local development, please use "terraform.local/bytebase/bytebase" instead
77
source = "registry.terraform.io/bytebase/bytebase"
88
}

examples/setup/approval_flow.tf

Whitespace-only changes.

examples/setup/data_masking.tf

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
resource "bytebase_policy" "masking_policy" {
2+
depends_on = [
3+
bytebase_instance.test
4+
]
5+
6+
parent = "instances/test-sample-instance/databases/employee"
7+
type = "MASKING"
8+
enforce = true
9+
inherit_from_parent = false
10+
11+
masking_policy {
12+
mask_data {
13+
table = "salary"
14+
column = "amount"
15+
masking_level = "FULL"
16+
}
17+
mask_data {
18+
table = "salary"
19+
column = "emp_no"
20+
masking_level = "NONE"
21+
}
22+
}
23+
}
24+
25+
resource "bytebase_policy" "masking_exception_policy" {
26+
depends_on = [
27+
bytebase_project.sample_project
28+
]
29+
30+
parent = bytebase_project.sample_project.name
31+
type = "MASKING_EXCEPTION"
32+
enforce = true
33+
inherit_from_parent = false
34+
35+
masking_exception_policy {
36+
exceptions {
37+
database = "instances/test-sample-instance/databases/employee"
38+
table = "salary"
39+
column = "amount"
40+
masking_level = "NONE"
41+
member = "user:[email protected]"
42+
action = "EXPORT"
43+
}
44+
exceptions {
45+
database = "instances/test-sample-instance/databases/employee"
46+
table = "salary"
47+
column = "amount"
48+
masking_level = "NONE"
49+
member = "user:[email protected]"
50+
action = "QUERY"
51+
}
52+
}
53+
}

examples/setup/environment.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Create a new environment named "Test"
2+
resource "bytebase_environment" "test" {
3+
resource_id = local.environment_id_test
4+
title = "Test"
5+
order = 0
6+
environment_tier_policy = "UNPROTECTED"
7+
}
8+
9+
# Create another environment named "Prod"
10+
resource "bytebase_environment" "prod" {
11+
resource_id = local.environment_id_prod
12+
title = "Prod"
13+
order = 1
14+
environment_tier_policy = "PROTECTED"
15+
}

examples/setup/gitops.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Create GitHub GitOps provider.
2+
resource "bytebase_vcs_provider" "github" {
3+
resource_id = "vcs-github"
4+
title = "GitHub GitOps"
5+
type = "GITHUB"
6+
access_token = "<github personal token>"
7+
}
8+
9+
# Connect to the GitHub repository.
10+
resource "bytebase_vcs_connector" "github" {
11+
depends_on = [
12+
bytebase_project.sample_project,
13+
bytebase_vcs_provider.github
14+
]
15+
16+
resource_id = "connector-github"
17+
title = "GitHub Connector"
18+
project = bytebase_project.sample_project.name
19+
vcs_provider = bytebase_vcs_provider.github.name
20+
repository_id = "ed-bytebase/gitops"
21+
repository_path = "ed-bytebase/gitops"
22+
repository_directory = "/bytebase"
23+
repository_branch = "main"
24+
repository_url = "https://github.com/ed-bytebase/gitops"
25+
}

examples/setup/instance.tf

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
# Create a new instance named "test instance"
3+
# You can replace the parameters with your real instance
4+
resource "bytebase_instance" "test" {
5+
depends_on = [
6+
bytebase_environment.test
7+
]
8+
resource_id = local.instance_id_test
9+
environment = bytebase_environment.test.name
10+
title = "test instance"
11+
engine = "MYSQL"
12+
13+
# You need to specific the data source
14+
data_sources {
15+
id = "admin data source"
16+
type = "ADMIN"
17+
username = "<The connection user name>"
18+
password = "<The connection user password>"
19+
host = "127.0.0.1"
20+
port = "3366"
21+
}
22+
23+
# And you can add another data_sources with RO type
24+
data_sources {
25+
id = "read-only data source"
26+
type = "READ_ONLY"
27+
username = "<The connection user name>"
28+
password = "<The connection user password>"
29+
host = "127.0.0.1"
30+
port = "3366"
31+
}
32+
}
33+
34+
# Create a new instance named "prod instance"
35+
resource "bytebase_instance" "prod" {
36+
depends_on = [
37+
bytebase_environment.prod
38+
]
39+
40+
resource_id = local.instance_id_prod
41+
environment = bytebase_environment.prod.name
42+
title = "prod instance"
43+
engine = "POSTGRES"
44+
45+
# You need to specific the data source
46+
data_sources {
47+
id = "admin data source"
48+
type = "ADMIN"
49+
username = "<The connection user name>"
50+
password = "<The connection user password>"
51+
host = "127.0.0.1"
52+
port = "54321"
53+
}
54+
}

0 commit comments

Comments
 (0)