databricks / terraform-provider-databricks

Databricks Terraform Provider
https://registry.terraform.io/providers/databricks/databricks/latest
Other
456 stars 393 forks source link

[ISSUE] Issue with generating `databricks_job` HCL with import block #4255

Closed botchniaque closed 1 day ago

botchniaque commented 1 day ago

I am trying to use the experimental feature of generating HCL for imported resources as described here https://opentofu.org/docs/language/import/generating-configuration/

I am getting errors.

Configuration

terraform {
  required_providers {

    databricks = {
      source  = "databricks/databricks"
      version = ">= 1.58.0, < 2.0.0"
    }
  }

}

import {
  to = databricks_job.test_import
  id = "123456..."

}

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. add import block for an existing databricks job (see "Configuration" section)
  2. call tofu plan -generate-config-out=generated.tf

Terraform and provider versions

tofu --version
OpenTofu v1.8.5
on darwin_arm64
+ provider registry.opentofu.org/databricks/databricks v1.59.0

Is it a regression?

Debug Output

Important Factoids

Would you like to implement a fix?

alexott commented 1 day ago

It's not a provider issue but is more on the TF/Tofu side.

Don't use it; instead, use the Terraform exporter functionality. It will correctly handle dependencies on other objects, and you can do selective exports, etc.