databricks-sdk-go icon indicating copy to clipboard operation
databricks-sdk-go copied to clipboard

[ISSUE]Terraform Plan failing with errors: Cannot read external location(multiple resources)

Open tyagip1 opened this issue 1 year ago • 1 comments

Description Terraform Plan fails with multiple errors: One of the error says: Error: cannot read external location: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. This is likely a bug in the Databricks SDK for Go or the underlying REST API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues. Request log: │ │ GET /api/2.1/unity-catalog/external-locations/noaa-cfs-bucket │ > * Host: │ > * Accept: application/json │ > * Authorization: REDACTED │ > * User-Agent: databricks-tf-provider/1.41.0 databricks-sdk-go/0.38.0 go/1.21.9 os/linux terraform/1.8.3 resource/external_location auth/pat cicd/gitlab │ < HTTP/2.0 403 Forbidden │ < * Content-Length: 52 │ < * Content-Type: application/json; charset=utf-8 │ < * Date: Fri, 10 May 2024 07:19:55 GMT │ < * Server: databricks │ < * Vary: Accept-Encoding │ < * X-Databricks-Reason-Phrase: Invalid access token. │ < { │ < "error_code": 403, │ < "message": "Invalid access token." │ < } │ │ │ with databricks_external_location.noaa_cfs_bucket, │ on databricks_external_locations.tf line 12, in resource "databricks_external_location" "noaa_cfs_bucket": │ 12: resource "databricks_external_location" "noaa_cfs_bucket" {

Reproduction Terraform plan with any of the below resource: External Location Instance Profile Service Principal Storage Credential Cluster Policy

Expected behavior Terraform Plan with the desired state

Is it a regression? Yes, It always worked. Facing this since today morning

Debug Logs ╷ │ Error: cannot read external location: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. This is likely a bug in the Databricks SDK for Go or the underlying REST API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues. Request log: │ │ GET /api/2.1/unity-catalog/external-locations/noaa-cfs-bucket │ > * Host: │ > * Accept: application/json │ > * Authorization: REDACTED │ > * User-Agent: databricks-tf-provider/1.41.0 databricks-sdk-go/0.38.0 go/1.21.9 os/linux terraform/1.8.3 resource/external_location auth/pat cicd/gitlab │ < HTTP/2.0 403 Forbidden │ < * Content-Length: 52 │ < * Content-Type: application/json; charset=utf-8 │ < * Date: Fri, 10 May 2024 07:19:55 GMT │ < * Server: databricks │ < * Vary: Accept-Encoding │ < * X-Databricks-Reason-Phrase: Invalid access token. │ < { │ < "error_code": 403, │ < "message": "Invalid access token." │ < } │ │ │ with databricks_external_location.noaa_cfs_bucket, │ on databricks_external_locations.tf line 12, in resource "databricks_external_location" "noaa_cfs_bucket": │ 12: resource "databricks_external_location" "noaa_cfs_bucket" { │ ╵ ╷ │ Error: cannot read instance profile: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. This is likely a bug in the Databricks SDK for Go or the underlying REST API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues. Request log: │ │ GET /api/2.0/instance-profiles/list │ > * Host: │ > * Accept: application/json │ > * Authorization: REDACTED │ > * User-Agent: databricks-tf-provider/1.41.0 databricks-sdk-go/0.38.0 go/1.21.9 os/linux terraform/1.8.3 resource/instance_profile auth/pat cicd/gitlab │ < HTTP/2.0 403 Forbidden │ < * Content-Length: 52 │ < * Content-Type: application/json; charset=utf-8 │ < * Date: Fri, 10 May 2024 07:19:55 GMT │ < * Server: databricks │ < * Vary: Accept-Encoding │ < * X-Databricks-Reason-Phrase: Invalid access token. │ < { │ < "error_code": 403, │ < "message": "Invalid access token." │ < } │ │ │ with databricks_instance_profile.instance_profile_zarr_s3, │ on databricks_instance_profile.tf line 2, in resource "databricks_instance_profile" "instance_profile_zarr_s3": │ 2: resource "databricks_instance_profile" "instance_profile_zarr_s3" { │ ╵ ╷ │ Error: cannot read storage credential: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. This is likely a bug in the Databricks SDK for Go or the underlying REST API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues. Request log: │ │ GET /api/2.1/unity-catalog/storage-credentials/icis-analytics-platform-catalogs-access-sandbox │ > * Host: │ > * Accept: application/json │ > * Authorization: REDACTED │ > * User-Agent: databricks-tf-provider/1.41.0 databricks-sdk-go/0.38.0 go/1.21.9 os/linux terraform/1.8.3 resource/storage_credential auth/pat cicd/gitlab │ < HTTP/2.0 403 Forbidden │ < * Content-Length: 52 │ < * Content-Type: application/json; charset=utf-8 │ < * Date: Fri, 10 May 2024 07:19:55 GMT │ < * Server: databricks │ < * Vary: Accept-Encoding │ < * X-Databricks-Reason-Phrase: Invalid access token. │ < { │ < "error_code": 403, │ < "message": "Invalid access token." │ < } │ │ │ with databricks_storage_credential.catalogs_access_role_sandbox, │ on databricks_storage_credentials.tf line 22, in resource "databricks_storage_credential" "catalogs_access_role_sandbox": │ 22: resource "databricks_storage_credential" "catalogs_access_role_sandbox" { │ ╵ ╷ │ Error: cannot read storage credential: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. This is likely a bug in the Databricks SDK for Go or the underlying REST API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues. Request log: │ │ GET /api/2.1/unity-catalog/storage-credentials/icis-analytics-platform-catalogs-access-dev │ > * Host: │ > * Accept: application/json │ > * Authorization: REDACTED │ > * User-Agent: databricks-tf-provider/1.41.0 databricks-sdk-go/0.38.0 go/1.21.9 os/linux terraform/1.8.3 resource/storage_credential auth/pat cicd/gitlab │ < HTTP/2.0 403 Forbidden │ < * Content-Length: 52 │ < * Content-Type: application/json; charset=utf-8 │ < * Date: Fri, 10 May 2024 07:19:55 GMT │ < * Server: databricks │ < * Vary: Accept-Encoding │ < * X-Databricks-Reason-Phrase: Invalid access token. │ < { │ < "error_code": 403, │ < "message": "Invalid access token." │ < } │ │ │ with databricks_storage_credential.catalogs_access_role_dev, │ on databricks_storage_credentials.tf line 31, in resource "databricks_storage_credential" "catalogs_access_role_dev": │ 31: resource "databricks_storage_credential" "catalogs_access_role_dev" { │ ╵ ╷ │ Error: cannot read cluster policy: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. This is likely a bug in the Databricks SDK for Go or the underlying REST API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues. Request log: │ │ GET /api/2.0/policies/clusters/get?policy_id=00136EB45495E820 │ > * Host: │ > * Accept: application/json │ > * Authorization: REDACTED │ > * User-Agent: databricks-tf-provider/1.41.0 databricks-sdk-go/0.38.0 go/1.21.9 os/linux terraform/1.8.3 resource/cluster_policy auth/pat cicd/gitlab │ < HTTP/2.0 403 Forbidden │ < * Content-Length: 52 │ < * Content-Type: application/json; charset=utf-8 │ < * Date: Fri, 10 May 2024 07:19:53 GMT │ < * Server: databricks │ < * Vary: Accept-Encoding │ < * X-Databricks-Reason-Phrase: Invalid access token. │ < { │ < "error_code": 403, │ < "message": "Invalid access token." │ < } │ │ │ with module.sandbox_compute_policy.databricks_cluster_policy.cluster_policy, │ on .terraform/modules/sandbox_compute_policy/main.tf line 1, in resource "databricks_cluster_policy" "cluster_policy": │ 1: resource "databricks_cluster_policy" "cluster_policy" { │ ╵ ╷ │ Error: cannot read cluster policy: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. This is likely a bug in the Databricks SDK for Go or the underlying REST API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues. Request log: │ │ GET /api/2.0/policies/clusters/get?policy_id=0014D063BFB38E50 │ > * Host: │ > * Accept: application/json │ > * Authorization: REDACTED │ > * User-Agent: databricks-tf-provider/1.41.0 databricks-sdk-go/0.38.0 go/1.21.9 os/linux terraform/1.8.3 resource/cluster_policy auth/pat cicd/gitlab │ < HTTP/2.0 403 Forbidden │ < * Content-Length: 52 │ < * Content-Type: application/json; charset=utf-8 │ < * Date: Fri, 10 May 2024 07:19:53 GMT │ < * Server: databricks │ < * Vary: Accept-Encoding │ < * X-Databricks-Reason-Phrase: Invalid access token. │ < { │ < "error_code": 403, │ < "message": "Invalid access token." │ < } │ │ │ with module.sandbox_compute_policy_multi_node.databricks_cluster_policy.cluster_policy, │ on .terraform/modules/sandbox_compute_policy_multi_node/main.tf line 1, in resource "databricks_cluster_policy" "cluster_policy": │ 1: resource "databricks_cluster_policy" "cluster_policy" { │ ╵ ╷ │ Error: cannot read cluster policy: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. This is likely a bug in the Databricks SDK for Go or the underlying REST API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues. Request log: │ │ GET /api/2.0/policies/clusters/get?policy_id=00060A[182](https://gitlab.b2b.regn.net/terraform/pipelines/ch/cha/CHA-RESGRP-Analytics-Platform-Databricks-Administration-eu-west-1/-/jobs/1472841#L182)51CBA70 │ > * Host: │ > * Accept: application/json │ > * Authorization: REDACTED │ > * User-Agent: databricks-tf-provider/1.41.0 databricks-sdk-go/0.38.0 go/1.21.9 os/linux terraform/1.8.3 resource/cluster_policy auth/pat cicd/gitlab │ < HTTP/2.0 403 Forbidden │ < * Content-Length: 52 │ < * Content-Type: application/json; charset=utf-8 │ < * Date: Fri, 10 May 2024 07:19:53 GMT │ < * Server: databricks │ < * Vary: Accept-Encoding │ < * X-Databricks-Reason-Phrase: Invalid access token. │ < { │ < "error_code": 403, │ < "message": "Invalid access token." │ < } │ │ │ with module.sandbox_compute_policy_single_node.databricks_cluster_policy.cluster_policy, │ on .terraform/modules/sandbox_compute_policy_single_node/main.tf line 1, in resource "databricks_cluster_policy" "cluster_policy": │ 1: resource "databricks_cluster_policy" "cluster_policy" { │ ╵

Other Information

  • OS: Linux
  • Version: User-Agent: databricks-tf-provider/1.41.0 databricks-sdk-go/0.38.0 go/1.21.9 os/linux terraform/1.8.3

Additional context Add any other context about the problem here.

tyagip1 avatar May 10 '24 07:05 tyagip1

I have the same problem today after weeks of using terraform for databricks successfully. Did you find a solution @tyagip1 ?

privard avatar Jun 14 '24 20:06 privard

Same issue here, worked then stopped working, how can I debug this further?

PaulBurridge avatar Oct 03 '24 08:10 PaulBurridge

Hi both, Apologies for late response. In my case, My workspace token got expired. I fixed it by re-running the terraform pipeline which was creatin workspace and token. Once, it updated the token. I could create resources via terraform.

tyagip1 avatar Oct 03 '24 09:10 tyagip1