From 382b2697a738a608bd6a015e012fc324baf1187a Mon Sep 17 00:00:00 2001 From: Subhajit Mondal Date: Wed, 18 Oct 2023 18:15:12 +0800 Subject: [PATCH] Add support to read options from the input step hcl --- modconfig/flowpipe_pipeline_step.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modconfig/flowpipe_pipeline_step.go b/modconfig/flowpipe_pipeline_step.go index 482beb70..86da5fe0 100644 --- a/modconfig/flowpipe_pipeline_step.go +++ b/modconfig/flowpipe_pipeline_step.go @@ -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 { @@ -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 }