@@ -503,31 +503,25 @@ func getWorkspaceApprovalSetting(computed bool) *schema.Schema {
503503								Elem : & schema.Resource {
504504									Schema : map [string ]* schema.Schema {
505505										"title" : {
506- 											Type :     schema .TypeString ,
507- 											Computed :  computed ,
508- 											Required :  ! computed ,
506+ 											Type :          schema .TypeString ,
507+ 											Required :      true ,
508+ 											ValidateFunc :  validation . StringIsNotEmpty ,
509509										},
510510										"description" : {
511511											Type :     schema .TypeString ,
512512											Computed : computed ,
513513											Optional : true ,
514514										},
515- 										"steps " : {
515+ 										"roles " : {
516516											Type :        schema .TypeList ,
517- 											Computed :    computed ,
518- 											Required :    ! computed ,
519- 											Description : "Approval flow following the step order." ,
520- 											Elem : & schema.Resource {
521- 												Schema : map [string ]* schema.Schema {
522- 													"role" : {
523- 														Type :     schema .TypeString ,
524- 														Required : true ,
525- 														ValidateDiagFunc : internal .ResourceNameValidation (
526- 															fmt .Sprintf ("^%s" , internal .RoleNamePrefix ),
527- 														),
528- 														Description : "The role require to review in this step" ,
529- 													},
530- 												},
517+ 											Required :    true ,
518+ 											Description : "The role require to review in this step" ,
519+ 											Elem : & schema.Schema {
520+ 												Type :        schema .TypeString ,
521+ 												Description : `Role full name in roles/{id} format.` ,
522+ 												ValidateDiagFunc : internal .ResourceNameValidation (
523+ 													fmt .Sprintf ("^%s" , internal .RoleNamePrefix ),
524+ 												),
531525											},
532526										},
533527									},
@@ -717,14 +711,9 @@ func parseApprovalExpression(callExpr *v1alpha1.Expr_Call) ([]map[string]interfa
717711func  flattenWorkspaceApprovalSetting (ctx  context.Context , client  api.Client , setting  * v1pb.WorkspaceApprovalSetting ) ([]interface {}, error ) {
718712	ruleList  :=  []interface {}{}
719713	for  _ , rule  :=  range  setting .Rules  {
720- 		stepList  :=  []interface {}{}
721- 		for  _ , step  :=  range  rule .Template .Flow .Steps  {
722- 			rawStep  :=  map [string ]interface {}{}
723- 			for  _ , node  :=  range  step .Nodes  {
724- 				rawStep ["role" ] =  node .Role 
725- 				break 
726- 			}
727- 			stepList  =  append (stepList , rawStep )
714+ 		roleList  :=  []interface {}{}
715+ 		for  _ , role  :=  range  rule .Template .Flow .Roles  {
716+ 			roleList  =  append (roleList , role )
728717		}
729718
730719		conditionList  :=  []map [string ]interface {}{}
@@ -746,7 +735,7 @@ func flattenWorkspaceApprovalSetting(ctx context.Context, client api.Client, set
746735				map [string ]interface {}{
747736					"title" :       rule .Template .Title ,
748737					"description" : rule .Template .Description ,
749- 					"steps " :       stepList ,
738+ 					"roles " :       roleList ,
750739				},
751740			},
752741		}
0 commit comments