Skip to content

Commit

Permalink
Fix flow background update (goauthentik#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
larsl-net committed Sep 13, 2024
1 parent 492fcaa commit b338c17
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/provider/resource_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ func resourceFlowSchemaToModel(d *schema.ResourceData) *api.FlowRequest {
Authentication: api.AuthenticationEnum(d.Get("authentication").(string)).Ptr(),
PolicyEngineMode: api.PolicyEngineMode(d.Get("policy_engine_mode").(string)).Ptr(),
Layout: api.FlowLayoutEnum(d.Get("layout").(string)).Ptr(),
Background: d.Get("background").(string),
DeniedAction: api.DeniedActionEnum(d.Get("denied_action").(string)).Ptr(),
}
return &m
Expand Down Expand Up @@ -156,6 +155,15 @@ func resourceFlowUpdate(ctx context.Context, d *schema.ResourceData, m interface
}

d.SetId(res.Slug)

if bg, ok := d.GetOk("background"); ok {
hr, err := c.client.FlowsApi.FlowsInstancesSetBackgroundUrlCreate(ctx, res.Slug).FilePathRequest(api.FilePathRequest{
Url: bg.(string),
}).Execute()
if err != nil {
return httpToDiag(d, hr, err)
}
}
return resourceFlowRead(ctx, d, m)
}

Expand Down

0 comments on commit b338c17

Please sign in to comment.