@@ -589,21 +589,36 @@ func (r *ClusterResource) ModifyPlan(ctx context.Context, req resource.ModifyPla
589
589
// Create is called when the resource is created.
590
590
func (r * ClusterResource ) Create (ctx context.Context , req resource.CreateRequest , resp * resource.CreateResponse ) {
591
591
// Read data supplied by Terraform runtime into the model
592
+ r .logWithContext (ctx , "INFO" , "Starting cluster creation" )
593
+
592
594
var data ClusterResourceModel
593
595
resp .Diagnostics .Append (req .Plan .Get (ctx , & data )... )
594
596
if resp .Diagnostics .HasError () {
597
+ r .logWithContext (ctx , "ERROR" , "Failed to read plan data" , map [string ]interface {}{"error" : resp .Diagnostics .Errors ()})
595
598
return
596
599
}
597
600
598
601
// Apply changes to the cluster, including the init RPC and skipping the node upgrade.
602
+ r .logWithContext (ctx , "DEBUG" , "Applying cluster changes" , map [string ]interface {}{
603
+ "csp" : data .CSP .ValueString (),
604
+ "name" : data .Name .ValueString (),
605
+ })
599
606
diags := r .apply (ctx , & data , false , true )
600
607
resp .Diagnostics .Append (diags ... )
601
608
if resp .Diagnostics .HasError () {
609
+ r .logWithContext (ctx , "ERROR" , "Failed to apply cluster changes" , map [string ]interface {}{"error" : resp .Diagnostics .Errors ()})
602
610
return
603
611
}
604
612
605
613
// Save data into Terraform state
614
+ r .logWithContext (ctx , "DEBUG" , "Saving cluster data to state" )
606
615
resp .Diagnostics .Append (resp .State .Set (ctx , & data )... )
616
+ if resp .Diagnostics .HasError () {
617
+ r .logWithContext (ctx , "ERROR" , "Failed to save cluster data to state" , map [string ]interface {}{"error" : resp .Diagnostics .Errors ()})
618
+ return
619
+ }
620
+
621
+ r .logWithContext (ctx , "INFO" , "Cluster creation completed successfully" )
607
622
}
608
623
609
624
// Read is called when the resource is read or refreshed.
0 commit comments