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
Create a workspace using databricks_mws_workspaces resource
Disable PAT tokens on the workspace by disabling the config flag- "enableTokensConfig": "false"
Configuration
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
Terraform and provider versions
All versions