Skip to content

Commit

Permalink
Merge pull request #22 from gary-beautypie/main
Browse files Browse the repository at this point in the history
Fix - Triggers
  • Loading branch information
GtheSheep authored Oct 4, 2021
2 parents 815d27a + 55311d0 commit be08339
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 be08339

Please sign in to comment.