@@ -37,7 +37,7 @@ type branchResource struct {
3737
3838// branchResourceModelV* and branchSchemaV* are defined in branch_resource_migration.go
3939
40- func branchResourceFromClient (ctx context.Context , branch * planetscale.Branch , organization , database types.String , diags diag.Diagnostics ) * branchResourceModelV1 {
40+ func branchResourceFromClient (ctx context.Context , branch * planetscale.Branch , organization , database types.String , seedData types. String , diags diag.Diagnostics ) * branchResourceModelV1 {
4141 if branch == nil {
4242 return nil
4343 }
@@ -50,6 +50,7 @@ func branchResourceFromClient(ctx context.Context, branch *planetscale.Branch, o
5050 return & branchResourceModelV1 {
5151 Organization : organization ,
5252 Database : database ,
53+ SeedData : seedData ,
5354
5455 Actor : actor ,
5556 Region : region ,
@@ -108,6 +109,7 @@ func (r *branchResource) Create(ctx context.Context, req resource.CreateRequest,
108109 org := data .Organization
109110 database := data .Database
110111 name := data .Name
112+ seedData := data .SeedData
111113
112114 if org .IsNull () || org .IsUnknown () || org .ValueString () == "" {
113115 resp .Diagnostics .AddAttributeError (path .Root ("organization" ), "organization is required" , "an organization must be provided and cannot be empty" )
@@ -131,6 +133,7 @@ func (r *branchResource) Create(ctx context.Context, req resource.CreateRequest,
131133 createReq := planetscale.CreateBranchReq {
132134 Name : name .ValueString (),
133135 ParentBranch : * parentBranch ,
136+ SeedData : seedData .ValueStringPointer (),
134137 }
135138 if ! data .RestoredFromBranch .IsNull () && ! data .RestoredFromBranch .IsUnknown () {
136139 var rfb restoredFromBranchResource
@@ -199,7 +202,7 @@ func (r *branchResource) Create(ctx context.Context, req resource.CreateRequest,
199202 branch = res .Branch
200203 }
201204
202- data = branchResourceFromClient (ctx , & branch , data .Organization , data .Database , resp .Diagnostics )
205+ data = branchResourceFromClient (ctx , & branch , data .Organization , data .Database , data . SeedData , resp .Diagnostics )
203206 if resp .Diagnostics .HasError () {
204207 return
205208 }
@@ -244,7 +247,7 @@ func (r *branchResource) Read(ctx context.Context, req resource.ReadRequest, res
244247 return
245248 }
246249
247- data = branchResourceFromClient (ctx , & res .Branch , data .Organization , data .Database , resp .Diagnostics )
250+ data = branchResourceFromClient (ctx , & res .Branch , data .Organization , data .Database , data . SeedData , resp .Diagnostics )
248251 if resp .Diagnostics .HasError () {
249252 return
250253 }
@@ -303,7 +306,7 @@ func (r *branchResource) Update(ctx context.Context, req resource.UpdateRequest,
303306 branch = res .Branch
304307 }
305308 }
306- data = branchResourceFromClient (ctx , & branch , data .Organization , data .Database , resp .Diagnostics )
309+ data = branchResourceFromClient (ctx , & branch , data .Organization , data .Database , data . SeedData , resp .Diagnostics )
307310 if resp .Diagnostics .HasError () {
308311 return
309312 }
0 commit comments