databricks / terraform-provider-databricks

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

[DOC] Cannot use Workspaces API on non-E2 accounts #442

Closed databrickslearner closed 3 years ago

databrickslearner commented 3 years ago

Hi There

we have used this code to create a data bricks workspace with AWS using the terraform code.

terraform plan is working well and no issues as such but when we are trying to run the terraform apply the below message is appearing. The credentails are same and when i use those credentails we are able to create workspace succfully.

In the provider we are giving the URL as below and giving the user id and password to connect URL which we are using in the below provide,tf

terraform { required_providers { databricks = { source = "databrickslabs/databricks" version = "0.2.9" } } }

provider "databricks" { host = "https://accounts.cloud.databricks.com/login" username = "demo@abc.com" password = "DKJSDJJK1!" /dummy user name password included here.. } Error: The account does not exist or the user does not belong to this account (404 on /api/2.0/accounts/99585238-26b2-45d6-aef0-af84d5dc547f/storage-configurations)

Note : Iam new to github and created account today and if this is not the right fourm please let me know where to put this issue

databrickslearner commented 3 years ago

Error: The account does not exist or the user does not belong to this account (404 on /api/2.0/accounts/99585238-26b2-45d6-aef0-af84d5dc547f/storage-configurations) Error: The account does not exist or the user does not belong to this account (404 on /api/2.0/accounts/99585238-26b2-45d6-aef0-af84d5dc547f/credentials)

nfx commented 3 years ago

Remove “/login” from host

databrickslearner commented 3 years ago

I have removed the /login and tried but still the same issue

databricks_mws_storage_configurations.this: Creating... databricks_mws_credentials.this: Creating...

Error: The account does not exist or the user does not belong to this account (404 on /api/2.0/accounts/99585238-26b2-45d6-aef0-af84d5dc547f/storage-configurations)

Error: The account does not exist or the user does not belong to this account (404 on /api/2.0/accounts/99585238-26b2-45d6-aef0-af84d5dc547f/credentials)

nfx commented 3 years ago

Please upload the code as a gist.

Though, by the looks of error - account id might be wrong for your username/password pair. Take a look at top right corner menu of accounts console for the correct account id.

Besides, we strongly encourage using environment variables for user/password/account id, not to keep them in code.

databrickslearner commented 3 years ago

Hi there I am using databricks account as external account id which is in alpha numeric and you mean is there any other ac id

databrickslearner commented 3 years ago

1 2 3 Please see the 3 images and I am giving the first one as account id which is external account id. Kindly suggest and do needful as this issue i am facing since 4 days to resolve but no luck yet

databrickslearner commented 3 years ago

Please upload the code as a gist.

Though, by the looks of error - account id might be wrong for your username/password pair. Take a look at top right corner menu of accounts console for the correct account id.

Besides, we strongly encourage using environment variables for user/password/account id, not to keep them in code.

Hi,

Please find the code here

terraform {
  required_providers {
    databricks = {
      source = "databrickslabs/databricks"
      version = "0.2.9"
    }
  }
}

provider "databricks" {
  host = "https://accounts.cloud.databricks.com"
  username = "XXXXXXXXX"
  password = "XXXXXXXXX"

resource "databricks_mws_credentials" "this" {
  account_id       = var.account_id
  credentials_name = "${local.prefix}-creds"
  role_arn         = aws_iam_role.cross_account_role.arn
}

resource "databricks_mws_storage_configurations" "this" {
  account_id                 = var.account_id
  storage_configuration_name = "${local.prefix}-storage"
  bucket_name                = aws_s3_bucket.root_storage_bucket.bucket
}

resource "databricks_mws_workspaces" "this" {
  account_id      = var.account_id
  workspace_name  = local.prefix
  deployment_name = local.prefix
  aws_region      =  "eu-west-1"

  credentials_id            = databricks_mws_credentials.this.credentials_id
  storage_configuration_id  = databricks_mws_storage_configurations.this.storage_configuration_id
  verify_workspace_runnning = true
}

I am trying to create a data bricks workspace, got below error

image

Could you please answer my few questions?

  1. Why i am unable to authenticate data bricks account , What is went worong here?

  2. In provider section what is host refer to?

databrickslearner commented 3 years ago

any thoughts on the above error ?

databrickslearner commented 3 years ago

Any pointers pls ??

nfx commented 3 years ago

@databrickslearner by the screenshots you've provided, it's not a multi-workspace E2 account.

Please reach out to your Databricks representative (or CSE) in order to proceed with creating a valid E2 multi-workspace account.

databrickslearner commented 3 years ago

Hi There

You are correct, yesterday night I have fixed this issue. The account which I am using is the standard plan free tier account and I had to take a new account which is E2 multi workspace account and thereafter it started working.

Thanks