Skip to content

Commit

Permalink
Don't set the input step input if value is nil for the integration at…
Browse files Browse the repository at this point in the history
…tributes.
  • Loading branch information
vhadianto committed Oct 19, 2023
1 parent ac8da09 commit 56e5c15
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions modconfig/flowpipe_pipeline_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -2258,6 +2258,7 @@ func (p *PipelineStepInput) Equals(iOther IPipelineStep) bool {

func (p *PipelineStepInput) GetInputs(evalContext *hcl.EvalContext) (map[string]interface{}, error) {

// TODO: remove the inline settings post Integrated 2023
var to []string
if p.UnresolvedAttributes[schema.AttributeTypeTo] == nil {
to = p.To
Expand Down Expand Up @@ -2470,6 +2471,28 @@ func (p *PipelineStepInput) GetInputs(evalContext *hcl.EvalContext) (map[string]
results[schema.AttributeTypeResponseUrl] = *responseUrl
}

// The real settings for Notify is here
if p.Notify != nil {
integration := p.Notify.Integration
if integration == cty.NilVal {
return nil, perr.BadRequestWithMessage(p.Name + ": integration must be supplied")
}

valueMap := integration.AsValueMap()
for key, value := range valueMap {
// TODO check for valid integration attributes, don't want base HCL attributes in the inputs
if value != cty.NilVal {
goVal, err := hclhelpers.CtyToGo(value)
if err != nil {
return nil, perr.BadRequestWithMessage(p.Name + ": unable to parse integration attribute to Go values: " + err.Error())
}
if !helpers.IsNil(goVal) {
results[key] = goVal
}
}
}
}

return results, nil
}

Expand Down

0 comments on commit 56e5c15

Please sign in to comment.