Skip to content

Commit cf8bfa3

Browse files
authored
chore: implement different authentication type for instance (#166)
* chore: proto update * chore: update docs * fix: ci * fix: test * chore: drop risk * chore: update * fix: lint * chore: protocol update * chore: update * chore: update * chore: update version * chore: implment different authentication type for instance * fix: lint * chore: update comment * chore: update * chore: update
1 parent 886fc0d commit cf8bfa3

File tree

24 files changed

+2247
-187
lines changed

24 files changed

+2247
-187
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.13.0
1+
3.13.1

docs/data-sources/instance.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The instance data source.
2828
- `activation` (Boolean) Whether assign license for this instance or not.
2929
- `data_sources` (Set of Object) (see [below for nested schema](#nestedatt--data_sources))
3030
- `databases` (Set of String) The databases full name in the resource.
31-
- `engine` (String) The instance engine. Support MYSQL, POSTGRES, TIDB, SNOWFLAKE, CLICKHOUSE, MONGODB, SQLITE, REDIS, ORACLE, SPANNER, MSSQL, REDSHIFT, MARIADB, OCEANBASE, COCKROACHDB.
31+
- `engine` (String) The instance engine. Supported engines: MYSQL, POSTGRES, TIDB, SNOWFLAKE, CLICKHOUSE, MONGODB, SQLITE, REDIS, ORACLE, SPANNER, MSSQL, REDSHIFT, MARIADB, OCEANBASE, STARROCKS, DORIS, HIVE, ELASTICSEARCH, BIGQUERY, DYNAMODB, DATABRICKS, COCKROACHDB, COSMOSDB, TRINO, CASSANDRA.
3232
- `engine_version` (String) The engine version.
3333
- `environment` (String) The environment name for your instance in "environments/{resource id}" format.
3434
- `external_link` (String) The external console URL managing this instance (e.g. AWS RDS console, your in-house DB instance console)
@@ -44,18 +44,77 @@ The instance data source.
4444

4545
Read-Only:
4646

47+
- `additional_addresses` (List of Object) (see [below for nested schema](#nestedobjatt--data_sources--additional_addresses))
48+
- `authentication_database` (String)
49+
- `authentication_private_key` (String)
50+
- `authentication_private_key_passphrase` (String)
51+
- `authentication_type` (String)
52+
- `aws_credential` (List of Object) (see [below for nested schema](#nestedobjatt--data_sources--aws_credential))
53+
- `azure_credential` (List of Object) (see [below for nested schema](#nestedobjatt--data_sources--azure_credential))
54+
- `cluster` (String)
4755
- `database` (String)
56+
- `direct_connection` (Boolean)
4857
- `external_secret` (List of Object) (see [below for nested schema](#nestedobjatt--data_sources--external_secret))
58+
- `extra_connection_parameters` (Map of String)
59+
- `gcp_credential` (List of Object) (see [below for nested schema](#nestedobjatt--data_sources--gcp_credential))
4960
- `host` (String)
5061
- `id` (String)
62+
- `master_name` (String)
63+
- `master_password` (String)
64+
- `master_username` (String)
5165
- `password` (String)
5266
- `port` (String)
67+
- `redis_type` (String)
68+
- `region` (String)
69+
- `replica_set` (String)
70+
- `sasl_config` (List of Object) (see [below for nested schema](#nestedobjatt--data_sources--sasl_config))
71+
- `service_name` (String)
72+
- `sid` (String)
73+
- `srv` (Boolean)
74+
- `ssh_host` (String)
75+
- `ssh_password` (String)
76+
- `ssh_port` (String)
77+
- `ssh_private_key` (String)
78+
- `ssh_user` (String)
5379
- `ssl_ca` (String)
5480
- `ssl_cert` (String)
5581
- `ssl_key` (String)
5682
- `type` (String)
5783
- `use_ssl` (Boolean)
5884
- `username` (String)
85+
- `verify_tls_certificate` (Boolean)
86+
- `warehouse_id` (String)
87+
88+
<a id="nestedobjatt--data_sources--additional_addresses"></a>
89+
### Nested Schema for `data_sources.additional_addresses`
90+
91+
Read-Only:
92+
93+
- `host` (String)
94+
- `port` (String)
95+
96+
97+
<a id="nestedobjatt--data_sources--aws_credential"></a>
98+
### Nested Schema for `data_sources.aws_credential`
99+
100+
Read-Only:
101+
102+
- `access_key_id` (String)
103+
- `external_id` (String)
104+
- `role_arn` (String)
105+
- `secret_access_key` (String)
106+
- `session_token` (String)
107+
108+
109+
<a id="nestedobjatt--data_sources--azure_credential"></a>
110+
### Nested Schema for `data_sources.azure_credential`
111+
112+
Read-Only:
113+
114+
- `client_id` (String)
115+
- `client_secret` (String)
116+
- `tenant_id` (String)
117+
59118

60119
<a id="nestedobjatt--data_sources--external_secret"></a>
61120
### Nested Schema for `data_sources.external_secret`
@@ -105,3 +164,34 @@ Read-Only:
105164
- `secret_type` (String)
106165

107166

167+
168+
169+
<a id="nestedobjatt--data_sources--gcp_credential"></a>
170+
### Nested Schema for `data_sources.gcp_credential`
171+
172+
Read-Only:
173+
174+
- `content` (String)
175+
176+
177+
<a id="nestedobjatt--data_sources--sasl_config"></a>
178+
### Nested Schema for `data_sources.sasl_config`
179+
180+
Read-Only:
181+
182+
- `kerberos` (List of Object) (see [below for nested schema](#nestedobjatt--data_sources--sasl_config--kerberos))
183+
184+
<a id="nestedobjatt--data_sources--sasl_config--kerberos"></a>
185+
### Nested Schema for `data_sources.sasl_config.kerberos`
186+
187+
Read-Only:
188+
189+
- `instance` (String)
190+
- `kdc_host` (String)
191+
- `kdc_port` (String)
192+
- `kdc_transport_protocol` (String)
193+
- `keytab` (String)
194+
- `primary` (String)
195+
- `realm` (String)
196+
197+

docs/data-sources/instance_list.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,77 @@ Read-Only:
5353

5454
Read-Only:
5555

56+
- `additional_addresses` (List of Object) (see [below for nested schema](#nestedobjatt--instances--data_sources--additional_addresses))
57+
- `authentication_database` (String)
58+
- `authentication_private_key` (String)
59+
- `authentication_private_key_passphrase` (String)
60+
- `authentication_type` (String)
61+
- `aws_credential` (List of Object) (see [below for nested schema](#nestedobjatt--instances--data_sources--aws_credential))
62+
- `azure_credential` (List of Object) (see [below for nested schema](#nestedobjatt--instances--data_sources--azure_credential))
63+
- `cluster` (String)
5664
- `database` (String)
65+
- `direct_connection` (Boolean)
5766
- `external_secret` (List of Object) (see [below for nested schema](#nestedobjatt--instances--data_sources--external_secret))
67+
- `extra_connection_parameters` (Map of String)
68+
- `gcp_credential` (List of Object) (see [below for nested schema](#nestedobjatt--instances--data_sources--gcp_credential))
5869
- `host` (String)
5970
- `id` (String)
71+
- `master_name` (String)
72+
- `master_password` (String)
73+
- `master_username` (String)
6074
- `password` (String)
6175
- `port` (String)
76+
- `redis_type` (String)
77+
- `region` (String)
78+
- `replica_set` (String)
79+
- `sasl_config` (List of Object) (see [below for nested schema](#nestedobjatt--instances--data_sources--sasl_config))
80+
- `service_name` (String)
81+
- `sid` (String)
82+
- `srv` (Boolean)
83+
- `ssh_host` (String)
84+
- `ssh_password` (String)
85+
- `ssh_port` (String)
86+
- `ssh_private_key` (String)
87+
- `ssh_user` (String)
6288
- `ssl_ca` (String)
6389
- `ssl_cert` (String)
6490
- `ssl_key` (String)
6591
- `type` (String)
6692
- `use_ssl` (Boolean)
6793
- `username` (String)
94+
- `verify_tls_certificate` (Boolean)
95+
- `warehouse_id` (String)
96+
97+
<a id="nestedobjatt--instances--data_sources--additional_addresses"></a>
98+
### Nested Schema for `instances.data_sources.additional_addresses`
99+
100+
Read-Only:
101+
102+
- `host` (String)
103+
- `port` (String)
104+
105+
106+
<a id="nestedobjatt--instances--data_sources--aws_credential"></a>
107+
### Nested Schema for `instances.data_sources.aws_credential`
108+
109+
Read-Only:
110+
111+
- `access_key_id` (String)
112+
- `external_id` (String)
113+
- `role_arn` (String)
114+
- `secret_access_key` (String)
115+
- `session_token` (String)
116+
117+
118+
<a id="nestedobjatt--instances--data_sources--azure_credential"></a>
119+
### Nested Schema for `instances.data_sources.azure_credential`
120+
121+
Read-Only:
122+
123+
- `client_id` (String)
124+
- `client_secret` (String)
125+
- `tenant_id` (String)
126+
68127

69128
<a id="nestedobjatt--instances--data_sources--external_secret"></a>
70129
### Nested Schema for `instances.data_sources.external_secret`
@@ -114,3 +173,34 @@ Read-Only:
114173
- `secret_type` (String)
115174

116175

176+
177+
178+
<a id="nestedobjatt--instances--data_sources--gcp_credential"></a>
179+
### Nested Schema for `instances.data_sources.gcp_credential`
180+
181+
Read-Only:
182+
183+
- `content` (String)
184+
185+
186+
<a id="nestedobjatt--instances--data_sources--sasl_config"></a>
187+
### Nested Schema for `instances.data_sources.sasl_config`
188+
189+
Read-Only:
190+
191+
- `kerberos` (List of Object) (see [below for nested schema](#nestedobjatt--instances--data_sources--sasl_config--kerberos))
192+
193+
<a id="nestedobjatt--instances--data_sources--sasl_config--kerberos"></a>
194+
### Nested Schema for `instances.data_sources.sasl_config.kerberos`
195+
196+
Read-Only:
197+
198+
- `instance` (String)
199+
- `kdc_host` (String)
200+
- `kdc_port` (String)
201+
- `kdc_transport_protocol` (String)
202+
- `keytab` (String)
203+
- `primary` (String)
204+
- `realm` (String)
205+
206+

docs/resources/instance.md

Lines changed: 100 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The instance resource.
1818
### Required
1919

2020
- `data_sources` (Block Set, Min: 1) The connection for the instance. You can configure read-only or admin connection account here. (see [below for nested schema](#nestedblock--data_sources))
21-
- `engine` (String) The instance engine. Support MYSQL, POSTGRES, TIDB, SNOWFLAKE, CLICKHOUSE, MONGODB, SQLITE, REDIS, ORACLE, SPANNER, MSSQL, REDSHIFT, MARIADB, OCEANBASE, COCKROACHDB.
21+
- `engine` (String) The instance engine. Supported engines: MYSQL, POSTGRES, TIDB, SNOWFLAKE, CLICKHOUSE, MONGODB, SQLITE, REDIS, ORACLE, SPANNER, MSSQL, REDSHIFT, MARIADB, OCEANBASE, STARROCKS, DORIS, HIVE, ELASTICSEARCH, BIGQUERY, DYNAMODB, DATABRICKS, COCKROACHDB, COSMOSDB, TRINO, CASSANDRA.
2222
- `resource_id` (String) The instance unique resource id.
2323
- `title` (String) The instance title.
2424

@@ -44,21 +44,83 @@ The instance resource.
4444

4545
Required:
4646

47-
- `host` (String) Host or socket for your instance, or the account name if the instance type is Snowflake.
4847
- `id` (String) The unique data source id in this instance.
49-
- `port` (String) The port for your instance.
5048
- `type` (String) The data source type. Should be ADMIN or READ_ONLY. The READ_ONLY data source requires the instance license.
5149

5250
Optional:
5351

52+
- `additional_addresses` (Block List) Additional addresses for MongoDB replica set. Only available for MONGODB engine. (see [below for nested schema](#nestedblock--data_sources--additional_addresses))
53+
- `authentication_database` (String) The database to authenticate against for MongoDB. Only available for MONGODB engine.
54+
- `authentication_private_key` (String, Sensitive) PKCS#8 private key for authentication.
55+
- `authentication_private_key_passphrase` (String, Sensitive) Passphrase for encrypted private key.
56+
- `authentication_type` (String) Authentication type. Supported values depend on engine: COSMOSDB only supports AZURE_IAM; MSSQL supports PASSWORD, AZURE_IAM; ELASTICSEARCH supports PASSWORD, AWS_RDS_IAM; SPANNER, BIGQUERY only support GOOGLE_CLOUD_SQL_IAM; Most other engines support PASSWORD, GOOGLE_CLOUD_SQL_IAM, AWS_RDS_IAM. Default is PASSWORD.
57+
- `aws_credential` (Block List, Max: 1) AWS IAM credential. Only valid when authentication_type is AWS_RDS_IAM. (see [below for nested schema](#nestedblock--data_sources--aws_credential))
58+
- `azure_credential` (Block List, Max: 1) Azure IAM credential. Only valid when authentication_type is AZURE_IAM. (see [below for nested schema](#nestedblock--data_sources--azure_credential))
59+
- `cluster` (String) CockroachDB cluster name. Only available for COCKROACHDB engine.
5460
- `database` (String) The database for the instance, you can set this if the engine type is POSTGRES.
55-
- `external_secret` (Block List, Max: 1) The external secret to get the database password. Require instance license to enable this feature. Learn more: https://www.bytebase.com/docs/get-started/instance/#use-external-secret-manager (see [below for nested schema](#nestedblock--data_sources--external_secret))
61+
- `direct_connection` (Boolean) Use direct connection to MongoDB node. Only available for MONGODB engine.
62+
- `external_secret` (Block List, Max: 1) The external secret to get the database password. Only available when authentication_type is PASSWORD. Requires instance license. Learn more: https://www.bytebase.com/docs/get-started/instance/#use-external-secret-manager (see [below for nested schema](#nestedblock--data_sources--external_secret))
63+
- `extra_connection_parameters` (Map of String) Extra connection parameters as key-value pairs. Only available for MYSQL, MARIADB, OCEANBASE, POSTGRES, ORACLE, MSSQL, MONGODB.
64+
- `gcp_credential` (Block List, Max: 1) GCP IAM credential (service account JSON). Only valid when authentication_type is GOOGLE_CLOUD_SQL_IAM. (see [below for nested schema](#nestedblock--data_sources--gcp_credential))
65+
- `host` (String) Host or socket for your instance, or the account name if the instance type is Snowflake. Not required for some engines like DYNAMODB.
66+
- `master_name` (String) Redis Sentinel master name. Only available for REDIS engine.
67+
- `master_password` (String, Sensitive) Redis Sentinel master password. Only available for REDIS engine.
68+
- `master_username` (String) Redis Sentinel master username. Only available for REDIS engine.
5669
- `password` (String, Sensitive) The connection user password used by Bytebase to perform DDL and DML operations.
70+
- `port` (String) The port for your instance. Not required for some engines like SPANNER, BIGQUERY.
71+
- `redis_type` (String) Redis deployment type: STANDALONE, SENTINEL, CLUSTER. Only available for REDIS engine.
72+
- `region` (String) AWS region (e.g., us-east-1). Only available when authentication_type is AWS_RDS_IAM.
73+
- `replica_set` (String) The replica set name for MongoDB. Only available for MONGODB engine.
74+
- `sasl_config` (Block List, Max: 1) SASL authentication configuration. Only available for HIVE engine. (see [below for nested schema](#nestedblock--data_sources--sasl_config))
75+
- `service_name` (String) Oracle service name. Only available for ORACLE engine.
76+
- `sid` (String) Oracle System Identifier (SID). Only available for ORACLE engine.
77+
- `srv` (Boolean) Use DNS SRV record for MongoDB connection. Only available for MONGODB engine.
78+
- `ssh_host` (String) SSH tunnel server hostname. Only available for MYSQL, TIDB, MARIADB, OCEANBASE, POSTGRES, REDIS with PASSWORD authentication.
79+
- `ssh_password` (String, Sensitive) SSH tunnel password. Only available for MYSQL, TIDB, MARIADB, OCEANBASE, POSTGRES, REDIS with PASSWORD authentication.
80+
- `ssh_port` (String) SSH tunnel server port. Only available for MYSQL, TIDB, MARIADB, OCEANBASE, POSTGRES, REDIS with PASSWORD authentication.
81+
- `ssh_private_key` (String, Sensitive) SSH tunnel private key. Only available for MYSQL, TIDB, MARIADB, OCEANBASE, POSTGRES, REDIS with PASSWORD authentication.
82+
- `ssh_user` (String) SSH tunnel username. Only available for MYSQL, TIDB, MARIADB, OCEANBASE, POSTGRES, REDIS with PASSWORD authentication.
5783
- `ssl_ca` (String, Sensitive) The CA certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.
5884
- `ssl_cert` (String, Sensitive) The client certificate. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.
5985
- `ssl_key` (String, Sensitive) The client key. Optional, you can set this if the engine type is MYSQL, POSTGRES, TIDB or CLICKHOUSE.
6086
- `use_ssl` (Boolean) Enable SSL connection. Required to use SSL certificates.
6187
- `username` (String) The connection user name used by Bytebase to perform DDL and DML operations.
88+
- `verify_tls_certificate` (Boolean) Enable TLS certificate verification for SSL connections.
89+
- `warehouse_id` (String) Databricks warehouse ID. Only available for DATABRICKS engine.
90+
91+
<a id="nestedblock--data_sources--additional_addresses"></a>
92+
### Nested Schema for `data_sources.additional_addresses`
93+
94+
Required:
95+
96+
- `host` (String) The hostname of the additional address.
97+
- `port` (String) The port of the additional address.
98+
99+
100+
<a id="nestedblock--data_sources--aws_credential"></a>
101+
### Nested Schema for `data_sources.aws_credential`
102+
103+
Required:
104+
105+
- `access_key_id` (String) AWS access key ID.
106+
- `secret_access_key` (String, Sensitive) AWS secret access key.
107+
108+
Optional:
109+
110+
- `external_id` (String) External ID for additional security when assuming role.
111+
- `role_arn` (String) ARN of IAM role to assume for cross-account access.
112+
- `session_token` (String, Sensitive) AWS session token.
113+
114+
115+
<a id="nestedblock--data_sources--azure_credential"></a>
116+
### Nested Schema for `data_sources.azure_credential`
117+
118+
Required:
119+
120+
- `client_id` (String) Azure client ID.
121+
- `client_secret` (String, Sensitive) Azure client secret.
122+
- `tenant_id` (String) Azure tenant ID.
123+
62124

63125
<a id="nestedblock--data_sources--external_secret"></a>
64126
### Nested Schema for `data_sources.external_secret`
@@ -111,3 +173,37 @@ Required:
111173
- `secret_type` (String) The secret id type, can be PLAIN (plain text for the secret) or ENVIRONMENT (envirionment name for the secret).
112174

113175

176+
177+
178+
<a id="nestedblock--data_sources--gcp_credential"></a>
179+
### Nested Schema for `data_sources.gcp_credential`
180+
181+
Required:
182+
183+
- `content` (String, Sensitive) GCP service account JSON content.
184+
185+
186+
<a id="nestedblock--data_sources--sasl_config"></a>
187+
### Nested Schema for `data_sources.sasl_config`
188+
189+
Optional:
190+
191+
- `kerberos` (Block List, Max: 1) Kerberos configuration. (see [below for nested schema](#nestedblock--data_sources--sasl_config--kerberos))
192+
193+
<a id="nestedblock--data_sources--sasl_config--kerberos"></a>
194+
### Nested Schema for `data_sources.sasl_config.kerberos`
195+
196+
Required:
197+
198+
- `kdc_host` (String) The hostname of the Key Distribution Center (KDC).
199+
- `keytab` (String, Sensitive) The keytab file contents for authentication (base64 encoded).
200+
- `primary` (String) The primary component of the Kerberos principal.
201+
- `realm` (String) The Kerberos realm.
202+
203+
Optional:
204+
205+
- `instance` (String) The instance component of the Kerberos principal.
206+
- `kdc_port` (String) The port of the Key Distribution Center (KDC).
207+
- `kdc_transport_protocol` (String) The transport protocol for KDC communication (tcp or udp).
208+
209+

examples/database/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 = "3.13.0"
5+
version = "3.13.1"
66
# For local development, please use "terraform.local/bytebase/bytebase" instead
77
source = "registry.terraform.io/bytebase/bytebase"
88
}

examples/database_group/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
terraform {
22
required_providers {
33
bytebase = {
4-
version = "3.13.0"
4+
version = "3.13.1"
55
# For local development, please use "terraform.local/bytebase/bytebase" instead
66
source = "registry.terraform.io/bytebase/bytebase"
77
}

0 commit comments

Comments
 (0)