Skip to content

Commit 9d5033f

Browse files
authored
chore: update docs and examples (#36)
* chore: update docs * chore: update examples * fix: test
1 parent 69ea947 commit 9d5033f

20 files changed

+175
-151
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.6-beta.3
1+
0.0.7-alpha

docs/data-sources/database_role.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ The database role data source. You can get a single role in a specific instance
1616

1717
```terraform
1818
data "bytebase_database_role" "find_role" {
19-
name = "<role name>"
20-
instance = "<instance name>"
19+
name = "<role name>"
20+
instance = "<the instance resource id>"
21+
environment = "<the environment resource id>"
2122
}
2223
```
2324

2425
## Schema
2526

2627
### Required
2728

28-
- `name` (String) The role unique name.
29-
- `instance` (String) The instance unique name.
29+
- `name` (String) The role **unique name**.
30+
- `environment` (String) The environment **unique resource id**.
31+
- `instance` (String) The instance **unique resource id**.
3032

3133
### Read-Only
3234

docs/data-sources/database_role_list.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ The database role list data source. You can list roles in a specific instance th
1616

1717
```terraform
1818
data "bytebase_database_role_list" "list_role" {
19-
instance = "<instance name>"
19+
instance = "<the instance resource id>"
20+
environment = "<the environment resource id>"
2021
}
2122
```
2223

2324
## Schema
2425

2526
### Required
2627

27-
- `instance` (String) The instance unique name.
28+
- `environment` (String) The environment **unique resource id**.
29+
- `instance` (String) The instance **unique resource id**.
2830

2931
### Read-Only
3032

docs/data-sources/environment.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ The environment data source. You can get a single environment through `bytebase_
1313
## Example Usage
1414

1515
```terraform
16-
# Get environment named "dev"
16+
# Get environment by resource id
1717
data "bytebase_environment" "dev" {
18-
name = "dev"
18+
resource_id = "dev"
1919
}
2020
2121
output "env" {
@@ -31,20 +31,13 @@ You can check [examples](https://github.com/bytebase/terraform-provider-bytebase
3131

3232
### Required
3333

34-
- `name` (String) The environment unique name.
34+
- `resource_id` (String) The environment **unique resource id**.
3535

3636
### Read-Only
3737

3838
- `id` (Number) The ID of this resource.
39+
- `title` (String) The environment **unique** name.
3940
- `order` (Number) The environment sorting order. Starting with 1. Lower number appears first in the deployment pipeline.
4041
- `environment_tier_policy` (String) Check [Environment Tier](https://www.bytebase.com/docs/administration/environment-policy/tier) for details. Should be one of:
4142
- `PROTECTED`
4243
- `UNPROTECTED`
43-
- `pipeline_approval_policy` (String) Check [Approval Policy](https://www.bytebase.com/docs/administration/environment-policy/approval-policy) for details. Should be one of:
44-
- `MANUAL_APPROVAL_NEVER`
45-
- `MANUAL_APPROVAL_BY_PROJECT_OWNER`
46-
- `MANUAL_APPROVAL_BY_WORKSPACE_OWNER_OR_DBA`
47-
- `backup_plan_policy` (String) Check [Backup Schedule Policy](https://www.bytebase.com/docs/administration/environment-policy/backup-schedule-policy) for details. Should be one of:
48-
- `UNSET`
49-
- `DAILY`
50-
- `WEEKLY`

docs/data-sources/environment_list.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ You can check [examples](https://github.com/bytebase/terraform-provider-bytebase
2727

2828
## Schema
2929

30+
### Optional
31+
32+
- `show_deleted` (Boolean) If also show the deleted environments.
33+
3034
### Read-Only
3135

3236
- `environments` (List of Object) (see [below for nested schema](#nestedatt--environments))
33-
- `id` (String) The ID of this resource.
3437

3538
<a id="nestedatt--environments"></a>
3639

docs/data-sources/instance.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ The instance data source. You can get a single instance through `bytebase_instan
1313
## Example Usage
1414

1515
```terraform
16-
# Find a instance named "dev-instance"
16+
# Find a instance by resource id "dev-instance" in the "dev" environment.
1717
data "bytebase_instance" "dev" {
18-
name = "dev-instance"
18+
resource_id = "dev-instance"
19+
environment = "dev"
1920
}
2021
2122
output "instance" {
@@ -31,38 +32,39 @@ You can check [examples](https://github.com/bytebase/terraform-provider-bytebase
3132

3233
### Required
3334

34-
- `name` (String) The instance unique name.
35+
- `resource_id` (String) The instance **unique resource id**.
36+
- `environment` (String) The environment **unique resource id** for the instance.
3537

3638
### Read-Only
3739

3840
- `id` (Number) The instance id.
41+
- `title` (String) The instance name.
3942
- `engine` (String) The instance engine. Should be one of:
4043
- `MYSQL`
4144
- `POSTGRES`
4245
- `TIDB`
4346
- `SNOWFLAKE`
4447
- `CLICKHOUSE`
45-
- `environment` (String) The unique environment name for your instance.
46-
- `host` (String) Host or socket for your instance, or the account name if the instance type is Snowflake.
47-
- `port` (String) The port for your instance.
48+
- `SQLITE`
49+
- `MONGODB`
4850
- `external_link` (String) The external console URL managing this instance (e.g. AWS RDS console, your in-house DB instance console)
49-
- `database` (String) The database for your instance.
50-
- `data_source_list` (List of Object, Min: 1, Max: 3) The connection for the instance. You can configure read-only or admin connection account here. (see [below for nested schema](#nestedblock--data_source_list))
51+
- `data_sources` (List of Object) The connection for the instance. You can configure read-only or admin connection account here. (see [below for nested schema](#nestedblock--data_sources))
5152

52-
<a id="nestedblock--data_source_list"></a>
53+
<a id="nestedblock--data_sources"></a>
5354

54-
### Nested Schema for `data_source_list`
55+
### Nested Schema for `data_sources`
5556

5657
#### Read-Only
5758

58-
- `name` (String) The unique data source name in this instance.
59+
- `title` (String) The unique data source name in this instance.
5960
- `type` (String) The data source type. Should be one of:
6061
- `ADMIN`: The ADMIN type of data source.
61-
- `RO`: The read-only type of data source.
62+
- `READ_ONLY`: The read-only type of data source.
6263
- `username` (String) The connection user name used by Bytebase to perform DDL and DML operations.
6364
- `password` (String) The connection user password used by Bytebase to perform DDL and DML operations.
6465
- `ssl_ca` (String) The CA certificate. Optional, you can set this if the engine type is `CLICKHOUSE`.
6566
- `ssl_cert` (String) The client certificate. Optional, you can set this if the engine type is `CLICKHOUSE`.
6667
- `ssl_key` (String) The client key. Optional, you can set this if the engine type is `CLICKHOUSE`.
67-
- `host_override` (String) The Read-replica Host. Only works for RO type data source.
68-
- `port_override` (String) The Read-replica Port. Only works for RO type data source.
68+
- `host` (String) Host or socket for the data source, or the account name if the instance type is Snowflake.
69+
- `port` (String) The port for the data source.
70+
- `database` (String) The database for the data source.

docs/data-sources/instance_list.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,20 @@ The instance data source list. You can list instances through `bytebase_instance
1313
## Example Usage
1414

1515
```terraform
16-
# List instances
16+
# List all instances in all environments
1717
data "bytebase_instance_list" "all" {}
1818
1919
output "all_instances" {
20-
value = data.bytebase_instance_list.all.instances
20+
value = data.bytebase_instance_list.all
21+
}
22+
23+
# List all instances in the "dev" environment
24+
data "bytebase_instance_list" "dev_instances" {
25+
environment = "dev"
26+
}
27+
28+
output "dev_instances" {
29+
value = data.bytebase_instance_list.dev_instances
2130
}
2231
```
2332

@@ -27,9 +36,13 @@ You can check [examples](https://github.com/bytebase/terraform-provider-bytebase
2736

2837
## Schema
2938

39+
### Optional
40+
41+
- `environment` (String) The environment **unique resource id**.
42+
- `show_deleted` (Boolean) If also show the deleted instances.
43+
3044
### Read-Only
3145

32-
- `id` (String) The ID of this resource.
3346
- `instances` (List of Object) (see [below for nested schema](#nestedatt--instances))
3447

3548
<a id="nestedatt--instances"></a>
@@ -38,6 +51,6 @@ You can check [examples](https://github.com/bytebase/terraform-provider-bytebase
3851

3952
See [Instance Schema](https://registry.terraform.io/providers/bytebase/bytebase/latest/docs/data-sources/instance#schema).
4053

41-
### Nested Schema for `data_source_list`
54+
### Nested Schema for `data_sources`
4255

43-
See [Data Source Schema](https://registry.terraform.io/providers/bytebase/bytebase/latest/docs/data-sources/instance#nested-schema-for-data_source_list).
56+
See [Data Source Schema](https://registry.terraform.io/providers/bytebase/bytebase/latest/docs/data-sources/instance#nested-schema-for-data_sources).

docs/index.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@ provider "bytebase" {
6161

6262
```terraform
6363
# Usage example
64-
# Create a new environment named "dev"
64+
# Create a new environment named "Dev"
6565
resource "bytebase_environment" "dev" {
66-
name = "dev"
66+
resource_id = "dev"
67+
title = "Dev"
68+
order = 0
69+
environment_tier_policy = "UNPROTECTED"
6770
}
6871
```
6972

docs/resources/database_role.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Database role resource. You can read, create, update or delete a single role in
1717
```terraform
1818
resource "bytebase_database_role" "admin" {
1919
name = "admin"
20-
instance = <the instance unique name>
20+
instance = "<the instance resource id>"
21+
environment = "<the environment resource id>"
2122
password = "123456"
2223
connection_limit = 99
2324
valid_until = "2022-12-31T00:00:00+08:00"
@@ -41,7 +42,8 @@ resource "bytebase_database_role" "admin" {
4142
### Required
4243

4344
- `name` (String) The role **unique name**.
44-
- `instance` (String) The instance **unique name**.
45+
- `environment` (String) The environment **unique resource id**.
46+
- `instance` (String) The instance **unique resource id**.
4547
- `attribute` (Object) The attribute for the role. (see [below for nested schema](#nestedblock--attribute))
4648

4749
### Optional

docs/resources/environment.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,18 @@ The environment resource. You can read, create, update or delete a single enviro
1515
```terraform
1616
# Create a new environment named "dev"
1717
resource "bytebase_environment" "dev" {
18-
name = "dev"
19-
order = 1
18+
resource_id = "dev"
19+
title = "Dev"
20+
order = 1
2021
environment_tier_policy = "UNPROTECTED"
21-
pipeline_approval_policy = "MANUAL_APPROVAL_NEVER"
22-
backup_plan_policy = "UNSET"
2322
}
2423
2524
# Create a new environment named "prod"
2625
resource "bytebase_environment" "prod" {
27-
name = "prod"
28-
order = 2
26+
resource_id = "prod"
27+
title = "Prod"
28+
order = 2
2929
environment_tier_policy = "PROTECTED"
30-
pipeline_approval_policy = "MANUAL_APPROVAL_BY_WORKSPACE_OWNER_OR_DBA"
31-
backup_plan_policy = "DAILY"
3230
}
3331
```
3432

@@ -40,19 +38,15 @@ You can check [examples](https://github.com/bytebase/terraform-provider-bytebase
4038

4139
### Required
4240

43-
- `name` (String) The environment **unique** name.
41+
- `resource_id` (String) The environment **unique resource id**. For example, `dev`, `dev-env`.
42+
- `title` (String) The environment **unique name**. For example, `Dev`.
4443
- `order` (Number) The environment sorting order. Starting with 1. Lower number appears first in the deployment pipeline.
44+
45+
### Optional
46+
4547
- `environment_tier_policy` (String) Check [Environment Tier](https://www.bytebase.com/docs/administration/environment-policy/tier) for details. Should be one of:
4648
- `PROTECTED`
4749
- `UNPROTECTED`
48-
- `pipeline_approval_policy` (String) Check [Approval Policy](https://www.bytebase.com/docs/administration/environment-policy/approval-policy) for details. Should be one of:
49-
- `MANUAL_APPROVAL_NEVER`
50-
- `MANUAL_APPROVAL_BY_PROJECT_OWNER`
51-
- `MANUAL_APPROVAL_BY_WORKSPACE_OWNER_OR_DBA`
52-
- `backup_plan_policy` (String) Check [Backup Schedule Policy](https://www.bytebase.com/docs/administration/environment-policy/backup-schedule-policy) for details. Should be one of:
53-
- `UNSET`
54-
- `DAILY`
55-
- `WEEKLY`
5650

5751
### Read-Only
5852

0 commit comments

Comments
 (0)