Skip to content

Commit

Permalink
Fix - Triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary James committed Oct 4, 2021
1 parent 5030058 commit 55311d0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/resources/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package resources

import (
"context"
"encoding/json"
"log"
"strconv"

Expand Down Expand Up @@ -127,9 +128,6 @@ func resourceJobRead(ctx context.Context, d *schema.ResourceData, m interface{})
if err := d.Set("is_active", job.State == 1); err != nil {
return diag.FromErr(err)
}
if err := d.Set("triggers", job.Triggers); err != nil {
return diag.FromErr(err)
}
if err := d.Set("num_threads", job.Settings.Threads); err != nil {
return diag.FromErr(err)
}
Expand All @@ -143,6 +141,13 @@ func resourceJobRead(ctx context.Context, d *schema.ResourceData, m interface{})
return diag.FromErr(err)
}

var triggers map[string]interface{}
triggersInput, _ := json.Marshal(job.Triggers)
json.Unmarshal(triggersInput, &triggers)
if err := d.Set("triggers", triggers); err != nil {
return diag.FromErr(err)
}

return diags
}

Expand Down

0 comments on commit 55311d0

Please sign in to comment.