Skip to content

Commit

Permalink
Merge pull request #356 from hashicorp/b-fix-jobspec-diff
Browse files Browse the repository at this point in the history
resource/job: use semantic jobspec diff
  • Loading branch information
lgfa29 authored Jul 26, 2023
2 parents 0189123 + 1237149 commit cc2b3f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ BUG FIXES:
* data source/nomad_volume: fix panic when reading volume ([#323](https://github.com/hashicorp/terraform-provider-nomad/pull/323))
* resources/nomad_acl_binding_rule: fix a bug where `bind_name` was required even when `bind_type` was `management`. ([#330](https://github.com/hashicorp/terraform-provider-nomad/pull/330))
* resources/nomad_job: fix a bug that prevented deployments for jobs in namespaces other than `default` from being monitored. ([#347](https://github.com/hashicorp/terraform-provider-nomad/pull/347))
* resource/nomad_job: fix a bug that could result in unnecessary plan diffs from irrelevant changes. ([#356](https://github.com/hashicorp/terraform-provider-nomad/pull/356))
* resource/nomad_volume and resource/nomad_external_volume: fix a bug where `topology_request` was not persisted to state. ([#342](https://github.com/hashicorp/terraform-provider-nomad/pull/342)

## 1.4.20 (April 20, 2023)
Expand Down
6 changes: 5 additions & 1 deletion nomad/resource_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ func resourceJobCustomizeDiff(_ context.Context, d *schema.ResourceDiff, meta in

oldSpecRaw, newSpecRaw := d.GetChange("jobspec")

if oldSpecRaw.(string) == newSpecRaw.(string) {
if jobspecEqual("jobspec", oldSpecRaw.(string), newSpecRaw.(string), d) {
// nothing to do!
return nil
}
Expand Down Expand Up @@ -937,6 +937,10 @@ func jobTaskGroupsRaw(tgs []*api.TaskGroup) []interface{} {
// jobspecDiffSuppress is the DiffSuppressFunc used by the schema to
// check if two jobspecs are equal.
func jobspecDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
return jobspecEqual(k, old, new, d)
}

func jobspecEqual(k, old, new string, d ResourceFieldGetter) bool {
var oldJob *api.Job
var newJob *api.Job
var oldErr error
Expand Down

0 comments on commit cc2b3f9

Please sign in to comment.