diff --git a/azurerm/internal/services/databricks/databricks_workspace_resource.go b/azurerm/internal/services/databricks/databricks_workspace_resource.go index fa04f98f465d..464c007d2193 100644 --- a/azurerm/internal/services/databricks/databricks_workspace_resource.go +++ b/azurerm/internal/services/databricks/databricks_workspace_resource.go @@ -111,6 +111,16 @@ func resourceArmDatabricksWorkspace() *schema.Resource { Type: schema.TypeString, Computed: true, }, + + "workspace_url": { + Type: schema.TypeString, + Computed: true, + }, + + "workspace_id": { + Type: schema.TypeString, + Computed: true, + }, }, } } @@ -231,6 +241,8 @@ func resourceArmDatabricksWorkspaceRead(d *schema.ResourceData, meta interface{} d.Set("managed_resource_group_id", props.ManagedResourceGroupID) d.Set("managed_resource_group_name", managedResourceGroupID.ResourceGroup) d.Set("custom_parameters", flattenWorkspaceCustomParameters(props.Parameters)) + d.Set("workspace_url", props.WorkspaceURL) + d.Set("workspace_id", props.WorkspaceID) } return tags.FlattenAndSet(d, resp.Tags) diff --git a/azurerm/internal/services/databricks/tests/databricks_workspace_resource_test.go b/azurerm/internal/services/databricks/tests/databricks_workspace_resource_test.go index 9344d3d20fad..cbf7b7914142 100644 --- a/azurerm/internal/services/databricks/tests/databricks_workspace_resource_test.go +++ b/azurerm/internal/services/databricks/tests/databricks_workspace_resource_test.go @@ -3,6 +3,7 @@ package tests import ( "fmt" "net/http" + "regexp" "testing" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" @@ -95,6 +96,8 @@ func TestAccAzureRMDatabricksWorkspace_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testCheckAzureRMDatabricksWorkspaceExists(data.ResourceName), resource.TestCheckResourceAttrSet(data.ResourceName, "managed_resource_group_id"), + resource.TestMatchResourceAttr(data.ResourceName, "workspace_url", regexp.MustCompile("azuredatabricks.net")), + resource.TestCheckResourceAttrSet(data.ResourceName, "workspace_id"), ), }, data.ImportStep(), diff --git a/website/docs/r/databricks_workspace.html.markdown b/website/docs/r/databricks_workspace.html.markdown index 64326a0cb1e0..37ee2d4d5618 100644 --- a/website/docs/r/databricks_workspace.html.markdown +++ b/website/docs/r/databricks_workspace.html.markdown @@ -68,10 +68,14 @@ The following arguments are supported: The following attributes are exported: -* `id` - The ID of the Databricks Workspace. +* `id` - The ID of the Databricks Workspace in the Azure management plane. * `managed_resource_group_id` - The ID of the Managed Resource Group created by the Databricks Workspace. +* `workspace_url` - The workspace URL which is of the format 'adb-{workspaceId}.{random}.azuredatabricks.net' + +* `workspace_id` - The unique identifier of the databricks workspace in Databricks control plane. + ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: