dbt-labs / terraform-provider-dbtcloud

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

dbtcloud_job fails creating a job when is_active = false #226

Closed dsmdavid-az closed 4 months ago

dsmdavid-az commented 7 months ago

Describe the bug

When creating a job with the is_active set to false, terraform fails with an error. If the job is created with is_active = true, terraform apply runs successfully. Once the resource has been created, it can again be set to false is_active = false and terraform apply will successfully modify the resource. terraform destroy will work fine as well. Now that the resource has been destroyed, running terraform apply will again fail.

Error message

│ Error: Provider produced inconsistent result after apply │ │ When applying changes to dbtcloud_job.job_main, provider "provider[\"registry.terraform.io/dbt-labs/dbtcloud\"]" produced an unexpected new value: Root object was present, but
│ now absent. │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Resource configuration


terraform {
  required_providers {
    dbtcloud = {
      source  = "dbt-labs/dbtcloud"
      version = "0.2.16"
    }
  }
}

provider "dbtcloud" {
  account_id = id
  token      = "token"
  host_url   = "https://emea.dbt.com/api"
}

resource "dbtcloud_job" "job_main" {
  environment_id = id
  execute_steps = [
    "dbt ls"
  ]
  generate_docs            = false
  is_active = false
  name                     = "main"
  target_name              = "dev"
  num_threads              = 32
  project_id               = project.id
  run_generate_sources     = false
  triggers = {
    "custom_branch_only" : false,
    "github_webhook" : false,
    "git_provider_webhook" : false,
    "schedule" : true
  }
  schedule_days = [0, 1, 2, 3, 4, 5, 6]
  schedule_type = "days_of_week"
}

Expected behavior

The job resource is created as inactive when is_active = false

Config (please complete the following information):

( the version can be retrieved running the command terraform providers )

b-per commented 7 months ago

What is the use case for setting is_active to false?

I am thinking that I might update every resource and delete this config. What it does is the same as the destroy, so there is no point in creating a job with is_active = false

If you want the job not to run, you will have to update the triggers

github-actions[bot] commented 4 months ago

This issue has been marked as Stale because it has been open for 90 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.