Skip to content

Commit

Permalink
Add support to read options from the input step hcl
Browse files Browse the repository at this point in the history
  • Loading branch information
Subhajit97 committed Oct 18, 2023
1 parent 3a234da commit 382b269
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modconfig/flowpipe_pipeline_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -2391,6 +2391,16 @@ func (p *PipelineStepInput) GetInputs(evalContext *hcl.EvalContext) (map[string]
}
}

var options []string
if p.UnresolvedAttributes[schema.AttributeTypeOptions] == nil {
options = p.Options
} else {
diags := gohcl.DecodeExpression(p.UnresolvedAttributes[schema.AttributeTypeOptions], evalContext, &options)
if diags.HasErrors() {
return nil, error_helpers.HclDiagsToError(p.Name, diags)
}
}

results := map[string]interface{}{}

if to != nil {
Expand Down Expand Up @@ -2445,6 +2455,10 @@ func (p *PipelineStepInput) GetInputs(evalContext *hcl.EvalContext) (map[string]
results[schema.AttributeTypePrompt] = *prompt
}

if options != nil {
results[schema.AttributeTypeOptions] = options
}

return results, nil
}

Expand Down

0 comments on commit 382b269

Please sign in to comment.