Skip to content

Commit

Permalink
feat: add service principal to workspace module (#598)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayengee authored Jul 2, 2024
1 parent c0ba4d7 commit e9ea41a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions databricks-workspace-e2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,13 @@ resource "databricks_mws_workspaces" "databricks" {
storage_configuration_id = databricks_mws_storage_configurations.databricks.storage_configuration_id
network_id = databricks_mws_networks.networking.network_id
}

data "databricks_user" "tfe_service_principal" {
user_name = var.tfe_service_principal_name
}

resource "databricks_mws_permission_assignment" {
workspace_id = databricks_mws_workspaces.databricks.workspace_id
principal_id = databricks_user.tfe_service_principal.id
permissions = ["ADMIN"]
}
6 changes: 6 additions & 0 deletions databricks-workspace-e2/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,10 @@ variable "workspace_name_override" {
type = string
default = null
description = "Override the workspace name. If not set, the workspace name will be set to the project, env, and service."
}

variable "tfe_service_principal_name" {
type = string
default = null
description = "Name for the service principal for Terraform Enterprise, if available. Will be added as a workspace admin"
}

0 comments on commit e9ea41a

Please sign in to comment.