databricks / terraform-provider-databricks

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

[SOLVED] Issue with `databricks_mws_credentials` resource with version 1.31.1 #3059

Closed sebastienroy-accelex closed 10 months ago

sebastienroy-accelex commented 11 months ago

Hi team

Terraform and provider versions

Terraform v1.6.6
on linux_amd64
+ provider registry.terraform.io/databricks/databricks v1.31.1
+ provider registry.terraform.io/hashicorp/aws v5.31.0
+ provider registry.terraform.io/hashicorp/time v0.10.0

Is it a regression?

Yes, everything run fine with version 1.31.0. Broken with newer versions (>=1.31.1).

Configuration

provider "databricks" {
  alias    = "mws"
  host     = "https://accounts.cloud.databricks.com"
  username = "myUsername"
  password = "myPassword"
}

resource "databricks_mws_credentials" "this" {
  provider         = databricks.mws
  account_id       = "c33d28b7-83d1-538a-9b5e-89606c687690"
  credentials_name = "my-credentials"
  role_arn         = "arn:aws:iam::0123456789:role/databricks-cross-account-role"
}

Error

Error: cannot read mws credentials: invalid Databricks Account configuration

Debug Output

Providing only the relevant lines.

[ERROR] provider.terraform-provider-databricks_v1.31.1: Response contains error diagnostic: diagnostic_detail="" tf_provider_addr=registry.terraform.io/databricks/databricks tf_resource_type=databricks_mws_credentials diagnostic_severity=ERROR @module=sdk.proto tf_proto_version=5.4 tf_req_id=5d50180f-e313-6661-00d1-2180a839328e @caller=/home/runner/work/terraform-provider-databricks/terraform-provider-databricks/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_summary="cannot read mws credentials: invalid Databricks Account configuration" tf_rpc=ReadResource timestamp="2023-12-27T15:49:00.533+0100"
[ERROR] vertex "databricks_mws_credentials.this" error: cannot read mws credentials: invalid Databricks Account configuration
[ERROR] vertex "databricks_mws_credentials.this (expand)" error: cannot read mws credentials: invalid Databricks Account configuration
adam-carruthers commented 11 months ago

We are also having this same issue

VPAI-Bixal commented 11 months ago

We are also having this issue on 1.33.0

mgyucht commented 10 months ago

Thanks for raising. Are you using your AWS account ID in the account_id field of databricks_mws_credentials? You should be providing the E2 account ID there.

There was a bug with this in 1.31.0, but it was fixed in 1.32.0. To be 100% sure, you can try specifying the account ID in the provider block as opposed to in the databricks_mws_credentials resource.

VPAI-Bixal commented 10 months ago

Thanks for raising. Are you using your AWS account ID in the account_id field of databricks_mws_credentials? You should be providing the E2 account ID there.

There was a bug with this in 1.31.0, but it was fixed in 1.32.0. To be 100% sure, you can try specifying the account ID in the provider block as opposed to in the databricks_mws_credentials resource.

Another commenter suggested moving the account_id under provider and this resolved the issue for us. Thanks.

sebastienroy-accelex commented 10 months ago

Thanks for raising. Are you using your AWS account ID in the account_id field of databricks_mws_credentials? You should be providing the E2 account ID there.

There was a bug with this in 1.31.0, but it was fixed in 1.32.0. To be 100% sure, you can try specifying the account ID in the provider block as opposed to in the databricks_mws_credentials resource.

Hi @mgyucht . This is a wrong copy paste in my comment. I tried to make it simple but I actually made it more confusing. I updated the comment with a random ID. I also confirm I use E2 account ID for account_id.

waldman commented 10 months ago

Having same error here:

2024-01-15T13:40:37.670-0300 [ERROR] vertex "databricks_mws_credentials.databricks-e2-workspaces-1" error: cannot read mws credentials: invalid Databricks Account configuration
2024-01-15T13:40:37.670-0300 [ERROR] vertex "databricks_mws_credentials.databricks-e2-workspaces-1" error: cannot read mws credentials: invalid Databricks Account configuration
2024-01-15T13:40:37.670-0300 [ERROR] provider.terraform-provider-databricks_v1.34.0: Response contains error diagnostic: tf_provider_addr=registry.terraform.io/databricks/databricks @caller=/home/runner/work/terraform-provider-databricks/terraform-provider-databricks/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/diag/diagnostics.go:62 @module=sdk.proto diagnostic_detail= diagnostic_severity=ERROR tf_proto_version=5.4 tf_req_id=1f286ea3-9294-82ca-2b1e-3f91668dcf8c tf_resource_type=databricks_mws_credentials tf_rpc=ReadResource diagnostic_summary="cannot read mws credentials: invalid Databricks Account configuration" timestamp=2024-01-15T13:40:37.670-0300
2024-01-15T13:40:37.670-0300 [ERROR] vertex "databricks_mws_credentials.databricks-e2-workspaces-1 (expand)" error: cannot read mws credentials: invalid Databricks Account configuration

Moving account_id to provider section fixes it.

sebastienroy-accelex commented 10 months ago

Thanks @waldman @VPAI-Bixal ! Moving account_id to provider section fixed it for me. I am now able to use version 1.34.0.