-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from databricks/gcp
Gcp
- Loading branch information
Showing
5 changed files
with
112 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
variable "databricks_account_id" {} | ||
variable "new_admin_account" {} | ||
variable "dbx_existing_admin_account" { | ||
description = "Existing Databricks SA or user. Allows either user:[email protected], group:[email protected] or serviceAccount:[email protected] to impersonate created service account" | ||
|
||
} | ||
|
||
terraform { | ||
required_providers { | ||
databricks = { | ||
source = "databricks/databricks" | ||
version = ">=1.39.0" | ||
|
||
} | ||
google = { | ||
source = "hashicorp/google" | ||
} | ||
|
||
} | ||
} | ||
provider "databricks" { | ||
host = "https://accounts.gcp.databricks.com" | ||
google_service_account = var.dbx_existing_admin_account | ||
account_id = var.databricks_account_id | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
resource "databricks_user" "sa" { | ||
provider = databricks | ||
display_name = "SA for Account Provisionning" | ||
user_name = var.new_admin_account | ||
} | ||
resource "databricks_user_role" "my_user_account_admin" { | ||
provider = databricks | ||
user_id = databricks_user.sa.id | ||
role = "account_admin" | ||
} | ||
|
||
output "granted_admin_account" { | ||
value = databricks_user_role.my_user_account_admin.id | ||
description = "This email was added to the Databricks account as an admin user." | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Prerequisite : the current SA (configured via GOOGLE_APPLICATION_CREDENTIALS) needs to have token impersonnation rights over the SA "old_admin_account" | ||
Do note that this doesn't even check that the google service accounts exist, so it does need to be provisionned somewhere else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters