Skip to content

[ISSUE] Issue with databricks_jobs resource: default for source ignored #3951

@fjakobs

Description

@fjakobs

If I explicitly define the source value for a job resource and then later comment out the source attribute then it doesn't revert to the default value. Instead, it's always a no-op.

Configuration

terraform {
    required_providers {
        databricks = {
            source  = "databricks/databricks"
            "version": "1.40.0"
        }
    }
}

provider "databricks" {
    host = "XXXX"
}

resource "databricks_job" "this" {
    name = "fabian_job_debug"

    task {
        task_key = "python1"
        spark_python_task {
          python_file = "/Workspace/Shared/test.py"
          source = "GIT"
        }
        job_cluster_key = "job_cluster"
    }

    task {
        task_key = "python2"
        spark_python_task {
          python_file = "/Workspace/Shared/test.py"
          source = "WORKSPACE"
        }
        job_cluster_key = "job_cluster"
    }

    task {
        task_key = "python3"
        spark_python_task {
          python_file = "/Workspace/Shared/test.py"
        }
        job_cluster_key = "job_cluster"
    }

    job_cluster {
      job_cluster_key = "job_cluster"
      new_cluster {
        autoscale {
            min_workers = 1
            max_workers = 8
        }
        node_type_id = "Standard_D3_v2"
        spark_version = "13.3.x-scala2.12"
      }
    }

    git_source {
        branch = "master"
        provider = "awsCodeCommit"
        url = "https://git-codecommit.us-west-2.amazonaws.com/v1/repos/TEST_REPO"
    }
}

output "url" {
  value = databricks_job.this.url
}

Expected Behavior

When I comment out the source attributes then the value for source should be the default (whatever that is).

Actual Behavior

Commenting the source attributes has no effect. The value remains unchanged and Terraform considers this as "no change".

Steps to Reproduce

  1. terraform apply the code above
  2. Comment our the source attributes`
  3. terraform apply again

Terraform and provider versions

Terraform v1.5.7
on darwin_arm64
+ provider registry.terraform.io/databricks/databricks v1.40.0

Your version of Terraform is out of date! The latest version
is 1.9.5. You can update by downloading from https://www.terraform.io/downloads.html

Would you like to implement a fix?

no

Metadata

Metadata

Assignees

Labels

BugThe issue is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions