databricks / terraform-provider-databricks

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

Not able to refresh existing Databricks Terraform state after disabling PAT token #2607

Closed vivianwilfred closed 8 months ago

vivianwilfred commented 1 year ago

Configuration

# Copy-paste your Terraform configuration here

Expected Behavior

The Terraform plan has to work and must not break when we disable PAT tokens on the workspace

Actual Behavior

The issue is with the validation logic here - https://github.com/databricks/terraform-provider-databricks/blob/master/mws/resource_mws_workspaces.go#L197 Terraform runs a token/list API call to validate if the workspace is reachable. But when the PAT tokens are disabled on a workspace, the token/list API call returns a 404 response. Therefore the terraform plan always fails to validate the workspace. This is the error we see- ERROR : 2023-08-16T13:14:14.255Z [INFO] provider.terraform-provider-databricks_v1.19.0: Workspace is now running: timestamp=2023-08-16T13:14:14.255Z 2023-08-16T13:14:14.648Z [INFO] provider.terraform-provider-databricks_v1.19.0: workspace https://xxx-xxx-xxx.cloud.databricks.com/ is not yet reachable: Tokens are disabled.: timestamp=2023-08-16T13:14:14.648Z

Steps to Reproduce

  1. Create a workspace using databricks_mws_workspaces resource
  2. Disable PAT tokens on the workspace by disabling the config flag- "enableTokensConfig": "false"
  3. Run a terraform plan

Terraform and provider versions

All versions

mgyucht commented 1 year ago

@alexott @nkvuong Is there another API we could use for this? Maybe SCIM Me?

mgyucht commented 8 months ago

@vivianwilfred Just looked at this again and seems like we changed this to SCIM Me call, so this issue should be resolved.