Coder Social home page Coder Social logo

[ISSUE] Issue with `databricks_cluster_policy` resource. Two different type of libraries doesn't get installed in one go about terraform-provider-databricks HOT 2 CLOSED

pcsrijith avatar pcsrijith commented on August 12, 2024 1
[ISSUE] Issue with `databricks_cluster_policy` resource. Two different type of libraries doesn't get installed in one go

from terraform-provider-databricks.

Comments (2)

nkvuong avatar nkvuong commented on August 12, 2024 1

this looks like an underlying issue with the API, Terraform provider is sending both libraries in the definition

locals {
  default_policy = {
    "dbus_per_hour" : {
      "type" : "range",
      "maxValue" : 10
    },
    "autotermination_minutes" : {
      "type" : "fixed",
      "value" : 20,
      "hidden" : true
    },
    "custom_tags.Team" : {
      "type" : "fixed",
      "value" : "test"
    }
  }
}

resource "databricks_cluster_policy" "fair_use" {
  name       = "test cluster policy"
  definition = jsonencode(local.default_policy)

  libraries {
    pypi {
      package = "databricks-sdk==0.12.0"
    }
    maven {
      coordinates = "com.oracle.database.jdbc:ojdbc8:XXXX"
    }
  }
}

the debug log

2024-06-25T14:27:32.659+0100 [DEBUG] provider.terraform-provider-databricks_v1.48.0: POST /api/2.0/policies/clusters/edit
> {
>   "definition": "{\"autotermination_minutes\":{\"hidden\":true,\"type\":\"fixed\",\"value\":20},\"custom_tags.Team\":{\"type\":... (71 more bytes)",
>   "libraries": [
>     {
>       "maven": {
>         "coordinates": "com.oracle.database.jdbc:ojdbc8:XXXX"
>       },
>       "pypi": {
>         "package": "databricks-sdk==0.12.0"
>       }
>     }
>   ],
>   "name": "test cluster policy",
>   "policy_id": "001C043340CD70D0"
> }
< HTTP/2.0 200 OK
< {}: @module=databricks tf_provider_addr=registry.terraform.io/databricks/databricks @caller=/home/runner/work/terraform-provider-databricks/terraform-provider-databricks/logger/logger.go:33 tf_rpc=ApplyResourceChange tf_req_id=74d2d271-e26e-1592-452a-98b7cc2575db tf_resource_type=databricks_cluster_policy timestamp="2024-06-25T14:27:32.658+0100"
2024-06-25T14:27:32.888+0100 [DEBUG] provider.terraform-provider-databricks_v1.48.0: GET /api/2.0/policies/clusters/get?policy_id=001C043340CD70D0
< HTTP/2.0 200 OK
< {
<   "created_at_timestamp": 1719321848000,
<   "definition": "{\"autotermination_minutes\":{\"hidden\":true,\"type\":\"fixed\",\"value\":20},\"custom_tags.Team\":{\"type\":... (71 more bytes)",
<   "is_default": false,
<   "libraries": [
<     {
<       "maven": {
<         "coordinates": "com.oracle.database.jdbc:ojdbc8:XXXX"
<       }
<     }
<   ],
<   "name": "test cluster policy",
<   "policy_id": "001C043340CD70D0"
< }

from terraform-provider-databricks.

nkvuong avatar nkvuong commented on August 12, 2024 1

the issue is with the user code - this is how you specify multiple libraries.

@edwardfeng-db normally, we need to alias plural to singular, i.e. library to avoid confusion for users. Especially as clusters & jobs use singular library

resource "databricks_cluster_policy" "fair_use" {
  name       = "test cluster policy"
  definition = jsonencode(local.default_policy)

  libraries {
    maven {
      coordinates = "com.oracle.database.jdbc:ojdbc8:XXXX"
    }
  }
  libraries {
    pypi {
      package = "databricks-sdk==0.12.0"
    }
  }
}

from terraform-provider-databricks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.