Skip to content
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
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ go 1.24.4
toolchain go1.24.5

require (
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251028065552-6af993a4e965.2
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.10-20251028065552-6af993a4e965.1
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251112064355-0f07c1221251.2
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.10-20251112064355-0f07c1221251.1
connectrpc.com/connect v1.19.1
github.com/hashicorp/go-cty v1.5.0
github.com/hashicorp/terraform-plugin-docs v0.13.0
Expand All @@ -19,6 +19,7 @@ require (
)

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20250912141014-52f32327d4b0.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251028065552-6af993a4e965.2 h1:CZTFNOTvABA040G3+5NwGQAGS7T5LpD+BM2KlMJu+JU=
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251028065552-6af993a4e965.2/go.mod h1:II5aVnTLrAfZPAqR9V0Q31jk23r0XkASN5j0WuNKJt4=
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.10-20251028065552-6af993a4e965.1 h1:IGhBcGyGHyTFk4bnCoeBOB+4YqH7GyKx6Q3I706oHFk=
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.10-20251028065552-6af993a4e965.1/go.mod h1:hCjM3DsxzHQGb3QEnCNYrln9ZgB16AZLOVfRJZRKC0E=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20250912141014-52f32327d4b0.1 h1:31on4W/yPcV4nZHL4+UCiCvLPsMqe/vJcNg8Rci0scc=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20250912141014-52f32327d4b0.1/go.mod h1:fUl8CEN/6ZAMk6bP8ahBJPUJw7rbp+j4x+wCcYi2IG4=
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251112064355-0f07c1221251.2 h1:JHCYdnOEIwnJb5uQ/+obxF4Dituukc19QLBdSgdZ2NM=
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251112064355-0f07c1221251.2/go.mod h1:RvY9MaPrZB0Wh3feGeuWh1E+NuZMZRxKKl05xH3QPe4=
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.10-20251112064355-0f07c1221251.1 h1:eJqVKrlvzRdUT6pOm4bIZa7ZDFAnV8p7afKMo1SFEaQ=
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.10-20251112064355-0f07c1221251.1/go.mod h1:iixFwzTD0lQdRrbylrXjPWWRSasCc2UF3asVypVXecY=
connectrpc.com/connect v1.19.1 h1:R5M57z05+90EfEvCY1b7hBxDVOUl45PrtXtAV2fOC14=
connectrpc.com/connect v1.19.1/go.mod h1:tN20fjdGlewnSFeZxLKb0xwIZ6ozc3OQs2hTXy4du9w=
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
Expand Down
6 changes: 6 additions & 0 deletions provider/data_source_setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,11 @@ func getWorkspaceProfileSetting(computed bool) *schema.Schema {
},
},
},
"enable_audit_log_stdout": {
Type: schema.TypeBool,
Optional: true,
Description: "Enable audit logging to stdout in structured JSON format. Requires TEAM or ENTERPRISE license.",
},
},
},
}
Expand Down Expand Up @@ -774,6 +779,7 @@ func flattenWorkspaceProfileSetting(setting *v1pb.WorkspaceProfileSetting) []int
}
// If announcement is empty, don't set it at all - let Terraform handle it as unset
}
raw["enable_audit_log_stdout"] = setting.EnableAuditLogStdout

return []interface{}{raw}
}
Expand Down
5 changes: 5 additions & 0 deletions provider/resource_setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ func convertToV1WorkspaceProfileSetting(d *schema.ResourceData) (*v1pb.Workspace
}
updateMasks = append(updateMasks, "value.workspace_profile_setting_value.announcement")
}
if config := workspaceRawConfig.GetAttr("enable_audit_log_stdout"); !config.IsNull() {
workspacePrfile.EnableAuditLogStdout = raw["enable_audit_log_stdout"].(bool)
updateMasks = append(updateMasks, "value.workspace_profile_setting_value.enable_audit_log_stdout")
}

return workspacePrfile, updateMasks, nil
}
Expand Down Expand Up @@ -604,6 +608,7 @@ func resourceSettingDelete(ctx context.Context, d *schema.ResourceData, m interf
"value.workspace_profile_setting_value.token_duration",
"value.workspace_profile_setting_value.maximum_role_expiration",
"value.workspace_profile_setting_value.announcement",
"value.workspace_profile_setting_value.enable_audit_log_stdout",
}
case v1pb.Setting_DATA_CLASSIFICATION:
setting.Value = &v1pb.Value{
Expand Down
4 changes: 4 additions & 0 deletions provider/resource_setting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func TestAccSetting_WorkspaceProfile(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "workspace_profile.0.disallow_signup", "true"),
resource.TestCheckResourceAttr(resourceName, "workspace_profile.0.disallow_password_signin", "false"),
resource.TestCheckResourceAttr(resourceName, "workspace_profile.0.database_change_mode", "PIPELINE"),
resource.TestCheckResourceAttr(resourceName, "workspace_profile.0.enable_audit_log_stdout", "false"),
),
},
// Update workspace profile setting with domains
Expand All @@ -82,6 +83,7 @@ func TestAccSetting_WorkspaceProfile(t *testing.T) {
internal.TestCheckResourceExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "workspace_profile.0.domains.#", "2"),
resource.TestCheckResourceAttr(resourceName, "workspace_profile.0.enforce_identity_domain", "true"),
resource.TestCheckResourceAttr(resourceName, "workspace_profile.0.enable_audit_log_stdout", "true"),
resource.TestCheckResourceAttr(resourceName, "workspace_profile.0.announcement.#", "1"),
resource.TestCheckResourceAttr(resourceName, "workspace_profile.0.announcement.0.text", "Test announcement"),
resource.TestCheckResourceAttr(resourceName, "workspace_profile.0.announcement.0.level", "INFO"),
Expand Down Expand Up @@ -393,6 +395,7 @@ resource "bytebase_setting" "%s" {
disallow_password_signin = false
database_change_mode = "PIPELINE"
token_duration_in_seconds = 3600
enable_audit_log_stdout = false
}
}
`, identifier)
Expand All @@ -411,6 +414,7 @@ resource "bytebase_setting" "%s" {
enforce_identity_domain = true
token_duration_in_seconds = 7200
maximum_role_expiration_in_seconds = 86400
enable_audit_log_stdout = true
announcement {
text = "Test announcement"
link = "https://example.com/announcement"
Expand Down