Skip to content

Commit

Permalink
fix: flow stages as list not set
Browse files Browse the repository at this point in the history
  • Loading branch information
celaus committed Jan 3, 2025
1 parent efade44 commit 257228f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions coralogix/resource_coralogix_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ type FlowModel struct {
}

type FlowStageModel struct {
FlowStagesGroups types.Set `tfsdk:"flow_stages_groups"` // FlowStagesGroupModel
FlowStagesGroups types.List `tfsdk:"flow_stages_groups"` // FlowStagesGroupModel
TimeframeMs types.Int64 `tfsdk:"timeframe_ms"`
TimeframeType types.String `tfsdk:"timeframe_type"`
}
Expand Down Expand Up @@ -1083,7 +1083,7 @@ func (r *AlertResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
Required: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"flow_stages_groups": schema.SetNestedAttribute{
"flow_stages_groups": schema.ListNestedAttribute{
Required: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
Expand Down Expand Up @@ -3231,7 +3231,7 @@ func extractFlowStage(ctx context.Context, object types.Object) (*cxsdk.FlowStag
return flowStage, nil
}

func extractFlowStagesGroups(ctx context.Context, groups types.Set) (*cxsdk.FlowStagesGroups, diag.Diagnostics) {
func extractFlowStagesGroups(ctx context.Context, groups types.List) (*cxsdk.FlowStagesGroups, diag.Diagnostics) {
if groups.IsNull() || groups.IsUnknown() {
return nil, nil
}
Expand Down Expand Up @@ -4556,16 +4556,16 @@ func flattenFlowStage(ctx context.Context, stage *cxsdk.FlowStages) (*FlowStageM

}

func flattenFlowStagesGroups(ctx context.Context, stage *cxsdk.FlowStages) (types.Set, diag.Diagnostics) {
func flattenFlowStagesGroups(ctx context.Context, stage *cxsdk.FlowStages) (types.List, diag.Diagnostics) {
var flowStagesGroups []*FlowStagesGroupModel
for _, group := range stage.GetFlowStagesGroups().GetGroups() {
flowStageGroup, diags := flattenFlowStageGroup(ctx, group)
if diags.HasError() {
return types.SetNull(types.ObjectType{AttrTypes: flowStageGroupAttr()}), diags
return types.ListNull(types.ObjectType{AttrTypes: flowStageGroupAttr()}), diags
}
flowStagesGroups = append(flowStagesGroups, flowStageGroup)
}
return types.SetValueFrom(ctx, types.ObjectType{AttrTypes: flowStageGroupAttr()}, flowStagesGroups)
return types.ListValueFrom(ctx, types.ObjectType{AttrTypes: flowStageGroupAttr()}, flowStagesGroups)

}

Expand Down Expand Up @@ -5021,7 +5021,7 @@ func flowAttr() map[string]attr.Type {

func flowStageAttr() map[string]attr.Type {
return map[string]attr.Type{
"flow_stages_groups": types.SetType{
"flow_stages_groups": types.ListType{
ElemType: types.ObjectType{
AttrTypes: flowStageGroupAttr(),
},
Expand Down

0 comments on commit 257228f

Please sign in to comment.