Skip to content

Commit

Permalink
Ignore the Nomad token for the diff
Browse files Browse the repository at this point in the history
  • Loading branch information
remilapeyre committed Sep 28, 2020
1 parent 3215165 commit 51998ba
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion nomad/resource_job_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,20 @@ func resourceJobV2Register(register func(job *api.Job) error, d *schema.Resource
}

func hasChanges(diff *api.JobDiff) bool {
if len(diff.Fields)+len(diff.Objects) > 0 {
// Ignore the Nomad token if it is the only change
if len(diff.Objects) > 0 {
return true
}
if len(diff.Fields) > 1 {
return true
}
if len(diff.Fields) == 1 {
field := diff.Fields[0]
if field.Name != "NomadTokenID" || field.Type != "Deleted" {
return true
}
}

for _, tg := range diff.TaskGroups {
if len(tg.Fields)+len(tg.Objects) > 0 {
return true
Expand Down

0 comments on commit 51998ba

Please sign in to comment.