Skip to content

Commit 7c17d25

Browse files
Add docs and remove FF for DB Audit logging (#144)
1 parent 17af3d7 commit 7c17d25

File tree

5 files changed

+135
-18
lines changed

5 files changed

+135
-18
lines changed

docs/data-sources/db_audit_logging.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "ybm_db_audit_logging Data Source - ybm"
4+
subcategory: ""
5+
description: |-
6+
The data source to fetch DB Audit log configuration for a cluster given cluster ID in YugabyteDB Aeon.
7+
---
8+
9+
# ybm_db_audit_logging (Data Source)
10+
11+
The data source to fetch DB Audit log configuration for a cluster given cluster ID in YugabyteDB Aeon.
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "ybm_db_audit_logging" "example_db_audit_log_config" {
17+
cluster_id = "<cluster-id>"
18+
}
19+
```
20+
21+
<!-- schema generated by tfplugindocs -->
22+
## Schema
23+
24+
### Required
25+
26+
- `cluster_id` (String) ID of the cluster from which DB Audit Logs will be exported
27+
28+
### Read-Only
29+
30+
- `account_id` (String) ID of the account this DB Audit log configuration belongs to.
31+
- `cluster_name` (String) Name of the cluster from which DB Audit Logs will be exported
32+
- `config_id` (String) ID of the DB Audit log configuration
33+
- `integration_id` (String) ID of the integration to which the DB Audit Logs will be exported
34+
- `integration_name` (String) Name of the integration to which the DB Audit Logs will be exported
35+
- `project_id` (String) ID of the project this DB Audit log configuration belongs to.
36+
- `state` (String) The status of DB Audit Logging on the cluster
37+
- `ysql_config` (Attributes) The specification for a DB Audit ysql export configuration (see [below for nested schema](#nestedatt--ysql_config))
38+
39+
<a id="nestedatt--ysql_config"></a>
40+
### Nested Schema for `ysql_config`
41+
42+
Read-Only:
43+
44+
- `log_settings` (Attributes) Db Audit Ysql Log Settings (see [below for nested schema](#nestedatt--ysql_config--log_settings))
45+
- `statement_classes` (Set of String) List of ysql statements
46+
47+
<a id="nestedatt--ysql_config--log_settings"></a>
48+
### Nested Schema for `ysql_config.log_settings`
49+
50+
Read-Only:
51+
52+
- `log_catalog` (Boolean) These system catalog tables record system (as opposed to user) activity, such as metadata lookups and from third-party tools performing lookups
53+
- `log_client` (Boolean) Enable this option to echo log messages directly to clients such as ysqlsh and psql
54+
- `log_level` (String) Sets the severity level of logs written to clients
55+
- `log_parameter` (Boolean) Include the parameters that were passed with the statement in the logs
56+
- `log_relation` (Boolean) Create separate log entries for each relation (TABLE, VIEW, and so on) referenced in a SELECT or DML statement
57+
- `log_statement_once` (Boolean) Enable this setting to only include statement text and parameters for the first entry for a statement or sub-statement combination

docs/resources/db_audit_logging.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "ybm_db_audit_logging Resource - ybm"
4+
subcategory: ""
5+
description: |-
6+
The resource to manage DB Audit log configuration for a cluster in YugabyteDB Aeon.
7+
---
8+
9+
# ybm_db_audit_logging (Resource)
10+
11+
The resource to manage DB Audit log configuration for a cluster in YugabyteDB Aeon.
12+
13+
## Example Usage
14+
15+
```terraform
16+
# DB audit log configuration for a cluster
17+
resource "ybm_db_audit_logging" "sample-db-audit-log-config" {
18+
cluster_id = "<Your-Cluster-Id>"
19+
integration_name = "<Your-Integration-Name>"
20+
ysql_config = {
21+
log_settings = {
22+
log_catalog = true
23+
log_client = false
24+
log_relation = true
25+
log_level = "LOG"
26+
log_statement_once = true
27+
log_parameter = false
28+
}
29+
statement_classes = ["READ", "WRITE", "ROLE"]
30+
}
31+
}
32+
```
33+
34+
<!-- schema generated by tfplugindocs -->
35+
## Schema
36+
37+
### Required
38+
39+
- `cluster_id` (String) ID of the cluster from which DB Audit Logs will be exported
40+
- `integration_name` (String) Name of the integration to which the DB Audit Logs will be exported
41+
- `ysql_config` (Attributes) The specification for a DB Audit ysql export configuration (see [below for nested schema](#nestedatt--ysql_config))
42+
43+
### Read-Only
44+
45+
- `account_id` (String) ID of the account this DB Audit log configuration belongs to.
46+
- `cluster_name` (String) Name of the cluster from which DB Audit Logs will be exported
47+
- `config_id` (String) ID of the DB Audit logging configuration
48+
- `integration_id` (String) ID of the integration to which the DB Audit Logs will be exported
49+
- `project_id` (String) ID of the project this DB Audit log configuration belongs to.
50+
- `state` (String) The status of DB Audit Logging on the cluster
51+
52+
<a id="nestedatt--ysql_config"></a>
53+
### Nested Schema for `ysql_config`
54+
55+
Required:
56+
57+
- `log_settings` (Attributes) Db Audit Ysql Log Settings (see [below for nested schema](#nestedatt--ysql_config--log_settings))
58+
- `statement_classes` (Set of String) List of ysql statements
59+
60+
<a id="nestedatt--ysql_config--log_settings"></a>
61+
### Nested Schema for `ysql_config.log_settings`
62+
63+
Optional:
64+
65+
- `log_catalog` (Boolean) These system catalog tables record system (as opposed to user) activity, such as metadata lookups and from third-party tools performing lookups. Defaults to 'true' if not specified.
66+
- `log_client` (Boolean) Enable this option to echo log messages directly to clients such as ysqlsh and psql. Defaults to 'true' if not specified
67+
- `log_level` (String) Sets the severity level of logs written to clients. Defaults to 'LOG' if not specified
68+
- `log_parameter` (Boolean) Include the parameters that were passed with the statement in the logs. Defaults to 'false' if not specified
69+
- `log_relation` (Boolean) Create separate log entries for each relation (TABLE, VIEW, and so on) referenced in a SELECT or DML statement. Defaults to 'false' if not specified
70+
- `log_statement_once` (Boolean) Enable this setting to only include statement text and parameters for the first entry for a statement or sub-statement combination. Defaults to 'false' if not specified

managed/data_source_db_audit_logging.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type dataSourceDbAuditLoggingType struct{}
1919

2020
func (r dataSourceDbAuditLoggingType) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics) {
2121
return tfsdk.Schema{
22-
Description: `The data source to fetch DB Audit log configuration for a cluster given cluster ID or configuration ID in YugabyteDB Aeon.`,
22+
Description: `The data source to fetch DB Audit log configuration for a cluster given cluster ID in YugabyteDB Aeon.`,
2323
Attributes: map[string]tfsdk.Attribute{
2424
"account_id": {
2525
Description: "ID of the account this DB Audit log configuration belongs to.",

managed/fflags/feature_flags.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ type FeatureFlag string
1414

1515
const (
1616
GOOGLECLOUD_INTEGRATION_ENABLED FeatureFlag = "GOOGLECLOUD_INTEGRATION_ENABLED"
17-
DB_AUDIT_LOGGING FeatureFlag = "DB_AUDIT_LOGGING"
1817
CONNECTION_POOLING FeatureFlag = "CONNECTION_POOLING"
1918
DR FeatureFlag = "DR"
2019
)
2120

2221
var flagEnabled = map[FeatureFlag]bool{
2322
GOOGLECLOUD_INTEGRATION_ENABLED: false,
24-
DB_AUDIT_LOGGING: false,
2523
CONNECTION_POOLING: false,
2624
DR: false,
2725
}

managed/provider.go

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,7 @@ func (p *provider) GetResources(_ context.Context) (map[string]tfsdk.ResourceTyp
158158
"ybm_associate_metrics_exporter_cluster": resourceAssociateMetricsExporterClusterType{},
159159
"ybm_integration": resourceIntegrationType{},
160160
"ybm_db_query_logging": resourceDbQueryLoggingType{},
161-
}
162-
163-
// Add DB Audit logging resource only if the feature flag is enabled
164-
if fflags.IsFeatureFlagEnabled(fflags.DB_AUDIT_LOGGING) {
165-
resources["ybm_db_audit_logging"] = resourceDbAuditLoggingType{}
161+
"ybm_db_audit_logging": resourceDbAuditLoggingType{},
166162
}
167163

168164
// Add DR config resource only if the feature flag is enabled
@@ -175,16 +171,12 @@ func (p *provider) GetResources(_ context.Context) (map[string]tfsdk.ResourceTyp
175171

176172
func (p *provider) GetDataSources(_ context.Context) (map[string]tfsdk.DataSourceType, diag.Diagnostics) {
177173
dataSources := map[string]tfsdk.DataSourceType{
178-
"ybm_backup": dataSourceBackupType{},
179-
"ybm_cluster": dataClusterNameType{},
180-
"ybm_vpc": dataSourceVPCType{},
181-
"ybm_allow_list": dataSourceAllowListType{},
182-
"ybm_integration": dataSourceIntegrationType{},
183-
}
184-
185-
// Add DB Audit logging data source only if the feature flag is enabled
186-
if fflags.IsFeatureFlagEnabled(fflags.DB_AUDIT_LOGGING) {
187-
dataSources["ybm_db_audit_logging"] = dataSourceDbAuditLoggingType{}
174+
"ybm_backup": dataSourceBackupType{},
175+
"ybm_cluster": dataClusterNameType{},
176+
"ybm_vpc": dataSourceVPCType{},
177+
"ybm_allow_list": dataSourceAllowListType{},
178+
"ybm_integration": dataSourceIntegrationType{},
179+
"ybm_db_audit_logging": dataSourceDbAuditLoggingType{},
188180
}
189181

190182
return dataSources, nil

0 commit comments

Comments
 (0)