Summary
The current provider forces a resource replacement whenever job_type changes. This is overly aggressive — only certain transitions are actually restricted by the dbt Cloud API. The fix narrows the replacement requirement to just the transitions the API cannot handle in-place.
Current behavior
Any change to the job_type field (or the triggers that determine it) triggers RequiresReplace, destroying and recreating the job.
Desired behavior
Only transitions that the API restricts should force replacement:
| Transition |
Requires replace? |
| CI ↔ non-CI |
Yes — API rejects this |
| Adaptive ↔ non-Adaptive |
Yes — API rejects this |
| Scheduled → Other |
No — in-place update |
| Other → Scheduled |
No — in-place update |
| Scheduled/Other → Merge |
No — in-place update |
| Merge → Scheduled/Other |
No — in-place update |
Fix
Replace the blanket RequiresReplace plan modifier with logic that evaluates the old and new job types and only appends RequiresReplace for CI↔non-CI and Adaptive↔non-Adaptive transitions.
Tests added
TestAccDbtCloudJobResourceScheduledToOther — validates in-place update
- Additional job type transition acceptance tests in
resource_acceptance_job_type_transitions_test.go
Files
pkg/framework/objects/job/resource.go
pkg/framework/objects/job/resource_acceptance_job_type_transitions_test.go (new)
Source
Developed on branch fix/provider-bug-wsargent.
Summary
The current provider forces a resource replacement whenever
job_typechanges. This is overly aggressive — only certain transitions are actually restricted by the dbt Cloud API. The fix narrows the replacement requirement to just the transitions the API cannot handle in-place.Current behavior
Any change to the
job_typefield (or the triggers that determine it) triggersRequiresReplace, destroying and recreating the job.Desired behavior
Only transitions that the API restricts should force replacement:
Fix
Replace the blanket
RequiresReplaceplan modifier with logic that evaluates the old and new job types and only appendsRequiresReplacefor CI↔non-CI and Adaptive↔non-Adaptive transitions.Tests added
TestAccDbtCloudJobResourceScheduledToOther— validates in-place updateresource_acceptance_job_type_transitions_test.goFiles
pkg/framework/objects/job/resource.gopkg/framework/objects/job/resource_acceptance_job_type_transitions_test.go(new)Source
Developed on branch
fix/provider-bug-wsargent.