Skip to content

feat: add CockroachDB support #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
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
6 changes: 3 additions & 3 deletions docs/resources/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ Optional:
- `database` (String) The database for the instance, you can set this if the engine type is POSTGRES.
- `external_secret` (Block List, Max: 1) The external secret to get the database password. Learn more: https://www.bytebase.com/docs/get-started/instance/#use-external-secret-manager (see [below for nested schema](#nestedblock--data_sources--external_secret))
- `password` (String, Sensitive) The connection user password used by Bytebase to perform DDL and DML operations.
- `ssl_ca` (String, Sensitive) The CA certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.
- `ssl_cert` (String, Sensitive) The client certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.
- `ssl_key` (String, Sensitive) The client key. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.
- `ssl_ca` (String, Sensitive) The CA certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB, CLICKHOUSE or COCKROACHDB.
- `ssl_cert` (String, Sensitive) The client certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB, CLICKHOUSE or COCKROACHDB.
- `ssl_key` (String, Sensitive) The client key. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB, CLICKHOUSE or COCKROACHDB.
- `username` (String) The connection user name used by Bytebase to perform DDL and DML operations.

<a id="nestedblock--data_sources--external_secret"></a>
Expand Down
8 changes: 4 additions & 4 deletions provider/data_source_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func dataSourceInstance() *schema.Resource {
"engine": {
Type: schema.TypeString,
Computed: true,
Description: "The instance engine. Support MYSQL, POSTGRES, TIDB, SNOWFLAKE, CLICKHOUSE, MONGODB, SQLITE, REDIS, ORACLE, SPANNER, MSSQL, REDSHIFT, MARIADB, OCEANBASE.",
Description: "The instance engine. Support MYSQL, POSTGRES, TIDB, SNOWFLAKE, CLICKHOUSE, MONGODB, SQLITE, REDIS, ORACLE, SPANNER, MSSQL, REDSHIFT, MARIADB, OCEANBASE, COCKROACHDB.",
},
"engine_version": {
Type: schema.TypeString,
Expand Down Expand Up @@ -113,19 +113,19 @@ func dataSourceInstance() *schema.Resource {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
Description: "The CA certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.",
Description: "The CA certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB, CLICKHOUSE or COCKROACHDB.",
},
"ssl_cert": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
Description: "The client certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.",
Description: "The client certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB, CLICKHOUSE or COCKROACHDB.",
},
"ssl_key": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
Description: "The client key. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.",
Description: "The client key. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB, CLICKHOUSE or COCKROACHDB.",
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions provider/data_source_instance_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func dataSourceInstanceList() *schema.Resource {
"engine": {
Type: schema.TypeString,
Computed: true,
Description: "The instance engine. Support MYSQL, POSTGRES, TIDB, SNOWFLAKE, CLICKHOUSE, MONGODB, SQLITE, REDIS, ORACLE, SPANNER, MSSQL, REDSHIFT, MARIADB, OCEANBASE.",
Description: "The instance engine. Support MYSQL, POSTGRES, TIDB, SNOWFLAKE, CLICKHOUSE, MONGODB, SQLITE, REDIS, ORACLE, SPANNER, MSSQL, REDSHIFT, MARIADB, OCEANBASE, COCKROACHDB.",
},
"engine_version": {
Type: schema.TypeString,
Expand Down Expand Up @@ -169,19 +169,19 @@ func dataSourceInstanceList() *schema.Resource {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
Description: "The CA certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.",
Description: "The CA certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB, CLICKHOUSE or COCKROACHDB.",
},
"ssl_cert": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
Description: "The client certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.",
Description: "The client certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB, CLICKHOUSE or COCKROACHDB.",
},
"ssl_key": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
Description: "The client key. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.",
Description: "The client key. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB, CLICKHOUSE or COCKROACHDB.",
},
},
},
Expand Down
1 change: 1 addition & 0 deletions provider/internal/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ var EngineValidation = validation.StringInSlice([]string{
v1pb.Engine_DORIS.String(),
v1pb.Engine_HIVE.String(),
v1pb.Engine_ELASTICSEARCH.String(),
v1pb.Engine_COCKROACHDB.String(),
}, false)

// GetPolicyParentAndType returns the policy parent and type by the name.
Expand Down
2 changes: 1 addition & 1 deletion provider/resource_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func resourceInstance() *schema.Resource {
Type: schema.TypeString,
Required: true,
ValidateFunc: internal.EngineValidation,
Description: "The instance engine. Support MYSQL, POSTGRES, TIDB, SNOWFLAKE, CLICKHOUSE, MONGODB, SQLITE, REDIS, ORACLE, SPANNER, MSSQL, REDSHIFT, MARIADB, OCEANBASE.",
Description: "The instance engine. Support MYSQL, POSTGRES, TIDB, SNOWFLAKE, CLICKHOUSE, MONGODB, SQLITE, REDIS, ORACLE, SPANNER, MSSQL, REDSHIFT, MARIADB, OCEANBASE, COCKROACHDB.",
},
"engine_version": {
Type: schema.TypeString,
Expand Down