Skip to content

Commit 5522574

Browse files
authored
feat: database resource (#93)
* chore: use set for unordered collection * chore: update doc * fix: list all databases in the project * chore: update * fix: lint * chore: add databases for instance * chore: more error log * chore: update * chore: update * feat: database resource * fix: lint
1 parent 3177fcd commit 5522574

32 files changed

+976
-943
lines changed

docs/data-sources/database.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "bytebase_database Data Source - terraform-provider-bytebase"
4+
subcategory: ""
5+
description: |-
6+
The database data source.
7+
---
8+
9+
# bytebase_database (Data Source)
10+
11+
The database data source.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `name` (String) The database full name in instances/{instance}/databases/{database} format
21+
22+
### Read-Only
23+
24+
- `catalog` (List of Object) The databases catalog. (see [below for nested schema](#nestedatt--catalog))
25+
- `environment` (String) The database environment, will follow the instance environment by default
26+
- `id` (String) The ID of this resource.
27+
- `labels` (Map of String) The deployment and policy control labels.
28+
- `project` (String) The project full name for the database in projects/{project} format.
29+
- `schema_version` (String) The version of database schema.
30+
- `successful_sync_time` (String) The latest synchronization time.
31+
- `sync_state` (String) The existence of a database on latest sync.
32+
33+
<a id="nestedatt--catalog"></a>
34+
### Nested Schema for `catalog`
35+
36+
Read-Only:
37+
38+
- `schemas` (Set of Object) (see [below for nested schema](#nestedobjatt--catalog--schemas))
39+
40+
<a id="nestedobjatt--catalog--schemas"></a>
41+
### Nested Schema for `catalog.schemas`
42+
43+
Read-Only:
44+
45+
- `name` (String)
46+
- `tables` (Set of Object) (see [below for nested schema](#nestedobjatt--catalog--schemas--tables))
47+
48+
<a id="nestedobjatt--catalog--schemas--tables"></a>
49+
### Nested Schema for `catalog.schemas.tables`
50+
51+
Read-Only:
52+
53+
- `classification` (String)
54+
- `columns` (Set of Object) (see [below for nested schema](#nestedobjatt--catalog--schemas--tables--columns))
55+
- `name` (String)
56+
57+
<a id="nestedobjatt--catalog--schemas--tables--columns"></a>
58+
### Nested Schema for `catalog.schemas.tables.name`
59+
60+
Read-Only:
61+
62+
- `classification` (String)
63+
- `labels` (Map of String)
64+
- `name` (String)
65+
- `semantic_type` (String)
66+
67+

docs/data-sources/database_catalog.md

Lines changed: 0 additions & 54 deletions
This file was deleted.

docs/data-sources/database_list.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "bytebase_database_list Data Source - terraform-provider-bytebase"
4+
subcategory: ""
5+
description: |-
6+
The database data source list.
7+
---
8+
9+
# bytebase_database_list (Data Source)
10+
11+
The database data source list.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `parent` (String)
21+
22+
### Read-Only
23+
24+
- `databases` (List of Object) (see [below for nested schema](#nestedatt--databases))
25+
- `id` (String) The ID of this resource.
26+
27+
<a id="nestedatt--databases"></a>
28+
### Nested Schema for `databases`
29+
30+
Read-Only:
31+
32+
- `environment` (String)
33+
- `labels` (Map of String)
34+
- `name` (String)
35+
- `project` (String)
36+
- `schema_version` (String)
37+
- `successful_sync_time` (String)
38+
- `sync_state` (String)
39+
40+

docs/data-sources/instance.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ The instance data source.
2222
### Read-Only
2323

2424
- `data_sources` (Set of Object) (see [below for nested schema](#nestedatt--data_sources))
25-
- `databases` (Set of Object) The databases in the resource. (see [below for nested schema](#nestedatt--databases))
2625
- `engine` (String) The instance engine. Support MYSQL, POSTGRES, TIDB, SNOWFLAKE, CLICKHOUSE, MONGODB, SQLITE, REDIS, ORACLE, SPANNER, MSSQL, REDSHIFT, MARIADB, OCEANBASE.
2726
- `engine_version` (String) The engine version.
2827
- `environment` (String) The environment name for your instance in "environments/{resource id}" format.
@@ -50,17 +49,3 @@ Read-Only:
5049
- `username` (String)
5150

5251

53-
<a id="nestedatt--databases"></a>
54-
### Nested Schema for `databases`
55-
56-
Read-Only:
57-
58-
- `environment` (String)
59-
- `labels` (Map of String)
60-
- `name` (String)
61-
- `project` (String)
62-
- `schema_version` (String)
63-
- `successful_sync_time` (String)
64-
- `sync_state` (String)
65-
66-

docs/data-sources/instance_list.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ The instance data source list.
3030
Read-Only:
3131

3232
- `data_sources` (Set of Object) (see [below for nested schema](#nestedobjatt--instances--data_sources))
33-
- `databases` (Set of Object) (see [below for nested schema](#nestedobjatt--instances--databases))
3433
- `engine` (String)
3534
- `engine_version` (String)
3635
- `environment` (String)
@@ -58,17 +57,3 @@ Read-Only:
5857
- `username` (String)
5958

6059

61-
<a id="nestedobjatt--instances--databases"></a>
62-
### Nested Schema for `instances.databases`
63-
64-
Read-Only:
65-
66-
- `environment` (String)
67-
- `labels` (Map of String)
68-
- `name` (String)
69-
- `project` (String)
70-
- `schema_version` (String)
71-
- `successful_sync_time` (String)
72-
- `sync_state` (String)
73-
74-

docs/data-sources/policy.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The policy data source.
2121

2222
### Optional
2323

24+
- `global_masking_policy` (Block List, Max: 1) (see [below for nested schema](#nestedblock--global_masking_policy))
2425
- `masking_exception_policy` (Block List, Max: 1) (see [below for nested schema](#nestedblock--masking_exception_policy))
2526
- `parent` (String) The policy parent name for the policy, support projects/{resource id}, environments/{resource id}, instances/{resource id}, or instances/{resource id}/databases/{database name}
2627

@@ -31,6 +32,24 @@ The policy data source.
3132
- `inherit_from_parent` (Boolean) Decide if the policy should inherit from the parent.
3233
- `name` (String) The policy full name
3334

35+
<a id="nestedblock--global_masking_policy"></a>
36+
### Nested Schema for `global_masking_policy`
37+
38+
Optional:
39+
40+
- `rules` (Block List) (see [below for nested schema](#nestedblock--global_masking_policy--rules))
41+
42+
<a id="nestedblock--global_masking_policy--rules"></a>
43+
### Nested Schema for `global_masking_policy.rules`
44+
45+
Optional:
46+
47+
- `condition` (String) The condition expression
48+
- `id` (String) The unique rule id
49+
- `semantic_type` (String) The semantic type id
50+
51+
52+
3453
<a id="nestedblock--masking_exception_policy"></a>
3554
### Nested Schema for `masking_exception_policy`
3655

docs/data-sources/policy_list.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,30 @@ The policy data source list.
3030
Read-Only:
3131

3232
- `enforce` (Boolean)
33+
- `global_masking_policy` (List of Object) (see [below for nested schema](#nestedobjatt--policies--global_masking_policy))
3334
- `inherit_from_parent` (Boolean)
3435
- `masking_exception_policy` (List of Object) (see [below for nested schema](#nestedobjatt--policies--masking_exception_policy))
3536
- `name` (String)
3637
- `type` (String)
3738

39+
<a id="nestedobjatt--policies--global_masking_policy"></a>
40+
### Nested Schema for `policies.global_masking_policy`
41+
42+
Read-Only:
43+
44+
- `rules` (List of Object) (see [below for nested schema](#nestedobjatt--policies--global_masking_policy--rules))
45+
46+
<a id="nestedobjatt--policies--global_masking_policy--rules"></a>
47+
### Nested Schema for `policies.global_masking_policy.rules`
48+
49+
Read-Only:
50+
51+
- `condition` (String)
52+
- `id` (String)
53+
- `semantic_type` (String)
54+
55+
56+
3857
<a id="nestedobjatt--policies--masking_exception_policy"></a>
3958
### Nested Schema for `policies.masking_exception_policy`
4059

docs/data-sources/project.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ The project data source.
2424
- `allow_modify_statement` (Boolean) Allow modifying statement after issue is created.
2525
- `auto_enable_backup` (Boolean) Whether to automatically enable backup.
2626
- `auto_resolve_issue` (Boolean) Enable auto resolve issue.
27-
- `databases` (Set of Object) The databases in the resource. (see [below for nested schema](#nestedatt--databases))
2827
- `enforce_issue_title` (Boolean) Enforce issue title created by user instead of generated by Bytebase.
2928
- `id` (String) The ID of this resource.
3029
- `key` (String) The project key.
@@ -35,20 +34,6 @@ The project data source.
3534
- `title` (String) The project title.
3635
- `workflow` (String) The project workflow.
3736

38-
<a id="nestedatt--databases"></a>
39-
### Nested Schema for `databases`
40-
41-
Read-Only:
42-
43-
- `environment` (String)
44-
- `labels` (Map of String)
45-
- `name` (String)
46-
- `project` (String)
47-
- `schema_version` (String)
48-
- `successful_sync_time` (String)
49-
- `sync_state` (String)
50-
51-
5237
<a id="nestedatt--members"></a>
5338
### Nested Schema for `members`
5439

docs/data-sources/project_list.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ Read-Only:
3232
- `allow_modify_statement` (Boolean)
3333
- `auto_enable_backup` (Boolean)
3434
- `auto_resolve_issue` (Boolean)
35-
- `databases` (Set of Object) (see [below for nested schema](#nestedobjatt--projects--databases))
3635
- `enforce_issue_title` (Boolean)
3736
- `key` (String)
3837
- `members` (Set of Object) (see [below for nested schema](#nestedobjatt--projects--members))
@@ -43,20 +42,6 @@ Read-Only:
4342
- `title` (String)
4443
- `workflow` (String)
4544

46-
<a id="nestedobjatt--projects--databases"></a>
47-
### Nested Schema for `projects.databases`
48-
49-
Read-Only:
50-
51-
- `environment` (String)
52-
- `labels` (Map of String)
53-
- `name` (String)
54-
- `project` (String)
55-
- `schema_version` (String)
56-
- `successful_sync_time` (String)
57-
- `sync_state` (String)
58-
59-
6045
<a id="nestedobjatt--projects--members"></a>
6146
### Nested Schema for `projects.members`
6247

0 commit comments

Comments
 (0)