Skip to content

Commit 2e90f4e

Browse files
d-bytebaseclaude
andcommitted
feat: add approval template id field for Bytebase 3.12 compatibility
Add support for the new ApprovalTemplate.id field introduced in Bytebase API to support both built-in and custom approval templates. Changes: - Add required 'id' field to approval flow schema with validation - Update convertToV1ApprovalSetting to set template ID - Update flattenWorkspaceApprovalSetting to include template ID - Update Bytebase protobuf dependencies to latest version Built-in templates use 'bb.*' prefix (e.g., 'bb.project-owner', 'bb.workspace-dba'), while custom templates use UUIDs. Related: bytebase/bytebase#17689 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent a9542b5 commit 2e90f4e

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ go 1.24.4
55
toolchain go1.24.5
66

77
require (
8-
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251010051414-0534aa930702.1
9-
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.10-20251010051414-0534aa930702.1
8+
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251010220308-691f96ff880a.1
9+
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.10-20251010220308-691f96ff880a.1
1010
connectrpc.com/connect v1.19.1
1111
github.com/hashicorp/go-cty v1.5.0
1212
github.com/hashicorp/terraform-plugin-docs v0.13.0

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251010051414-0534aa930702.1 h1:T4v2vd8e4RkC6ccfOdsvmDZ7YnW2YyAT6OFMdwcPgOA=
2-
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251010051414-0534aa930702.1/go.mod h1:A57O99YuSmuL9rUI39AMITcbFfJc6Ikv48Qb6Y2EgCw=
3-
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.10-20251010051414-0534aa930702.1 h1:5bZgEFfHz4kUG6fkHH9wmBG3dxyaA5rKpaprSP0csTo=
4-
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.10-20251010051414-0534aa930702.1/go.mod h1:hCjM3DsxzHQGb3QEnCNYrln9ZgB16AZLOVfRJZRKC0E=
1+
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251010220308-691f96ff880a.1 h1:lHkgDYgiCUVEYxeBhBfwe53D90a/jr1kJskRHSls/WQ=
2+
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251010220308-691f96ff880a.1/go.mod h1:MQOZqauUrfWO1ApLaYR4F9cjujYikybwynvA3e0og5I=
3+
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.10-20251010220308-691f96ff880a.1 h1:l7ZT3ubbTddSaTBPfgGntWuhQgX/CMGGwxMRrYa6pr8=
4+
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.10-20251010220308-691f96ff880a.1/go.mod h1:hCjM3DsxzHQGb3QEnCNYrln9ZgB16AZLOVfRJZRKC0E=
55
connectrpc.com/connect v1.19.1 h1:R5M57z05+90EfEvCY1b7hBxDVOUl45PrtXtAV2fOC14=
66
connectrpc.com/connect v1.19.1/go.mod h1:tN20fjdGlewnSFeZxLKb0xwIZ6ozc3OQs2hTXy4du9w=
77
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=

provider/data_source_setting.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,12 @@ func getWorkspaceApprovalSetting(computed bool) *schema.Schema {
502502
Type: schema.TypeList,
503503
Elem: &schema.Resource{
504504
Schema: map[string]*schema.Schema{
505+
"id": {
506+
Type: schema.TypeString,
507+
Required: true,
508+
ValidateFunc: validation.StringIsNotEmpty,
509+
Description: "The approval template ID. Built-in templates use 'bb.*' prefix (e.g., 'bb.project-owner', 'bb.workspace-dba'), custom templates use UUIDs.",
510+
},
505511
"title": {
506512
Type: schema.TypeString,
507513
Required: true,
@@ -733,6 +739,7 @@ func flattenWorkspaceApprovalSetting(ctx context.Context, client api.Client, set
733739
"conditions": conditionList,
734740
"flow": []interface{}{
735741
map[string]interface{}{
742+
"id": rule.Template.Id,
736743
"title": rule.Template.Title,
737744
"description": rule.Template.Description,
738745
"roles": roleList,

provider/resource_setting.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ func convertToV1ApprovalSetting(d *schema.ResourceData) (*v1pb.WorkspaceApproval
371371
rawFlow := flowList[0].(map[string]interface{})
372372
approvalRule := &v1pb.WorkspaceApprovalSetting_Rule{
373373
Template: &v1pb.ApprovalTemplate{
374+
Id: rawFlow["id"].(string),
374375
Title: rawFlow["title"].(string),
375376
Description: rawFlow["description"].(string),
376377
Flow: &v1pb.ApprovalFlow{},

0 commit comments

Comments
 (0)