dbt-labs / terraform-provider-dbtcloud

dbt Cloud Terraform Provider
https://registry.terraform.io/providers/dbt-labs/dbtcloud
MIT License
82 stars 19 forks source link

Add self deferring functionality on dbt_cloud_job #86

Closed mwufigma closed 1 year ago

mwufigma commented 1 year ago

The logic is a little more complicated than other configurations. Summarized below:

Create Job:
if self_deferring:
  create a POST request to create a job, then send a subsequent POST request to update it with it's own ID

Update Job:
if self_deferring changed:
  if self_deferring == true:
    set deferring_job_id to itself
  else:
    set deferring_job_id to the actual deferring_job_id value in the resource

Reading from remote resource:
if deferring_job_id == job.ID:
  set self_deferring in ResourceSchema to true

Tested with make test (Though I noticed there were no unit tests for Jobs, only acceptance tests, which I will transition over to you)

GtheSheep commented 1 year ago

/ok-to-test sha=4df951de312ef340affd287367460384a1229efb

GtheSheep commented 1 year ago

/ok-to-test sha=7c6e54943d7f4d325caaa8724a9c2119f2fff2d6

GtheSheep commented 1 year ago

/ok-to-test sha=2f9b684d9d1af9832509097c8a6a49c45ac14f3a

GtheSheep commented 1 year ago

/ok-to-test sha=2c13051a7c1bd5788671fb7269914459f4cf3242