-
Notifications
You must be signed in to change notification settings - Fork 55
Feature/azure network redesign #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
connorbrown-db
wants to merge
24
commits into
main
Choose a base branch
from
feature/azure-network-redesign
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
6872e1f
feat(azure): Add support for SAT
connorbrown-db 80f75b9
tests(azure): Reenable tags checking, require terraform fmt in tests
connorbrown-db a01b508
fix(azure): Add various missing tags
connorbrown-db 59af995
style(azure): various whitespace/styling updates
connorbrown-db a6bb325
feat(azure): Remove default storage from metastore
connorbrown-db 566238f
feat(azure): Add catalog module
connorbrown-db 338cff6
feat(azure): Remove for_each spoke creation
connorbrown-db 83fe181
feat(azure): Add default catalog for spoke
connorbrown-db 12e845c
chore(azure): Terraform fmt
connorbrown-db 0acabc9
fix(azure): Make all SAT resources use the same azure provider
connorbrown-db c7921de
style(azure): Rename local.sat_spoke to local.sat_workspace
connorbrown-db 7a25352
docs(azure): Update README with SAT details
connorbrown-db 4b684e4
feat(azure): Switch to pessimistic pin for naming module
connorbrown-db dd733e3
feat(azure): Provision webauth workspace as a normal workspace, now s…
connorbrown-db f1791e6
feat(azure): Default SAT to the hub webauth workspace
connorbrown-db ffeacac
feat(azure): Remove dedicated SAT catalog and provider
connorbrown-db bebb806
docs(azure): Improve comments and README
connorbrown-db 95fac1c
fix(azure): CMK access policy dependency moved to correct access policy
connorbrown-db 762493d
tests(azure): Replace sat spoke test with nondefault test
connorbrown-db c3dd063
feat(azure): Add better support for resource_suffix on SAT catalog
connorbrown-db f021b36
feat(azure): Add azure management lock to webauth workspace to preven…
connorbrown-db a5d8f91
feat(azure): Allow dynamic dependency for SAT catalog on SAT module
connorbrown-db 8620b7f
feat(azure): Bump version of SAT module
connorbrown-db 9bc7438
fix(azure): Make webauth workspace use hub firewall
connorbrown-db File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,89 @@ | ||
locals { | ||
create_sat_sp = var.sat_configuration.enabled && var.sat_service_principal.client_id == "" | ||
sat_client_id = local.create_sat_sp ? azuread_service_principal.sat[0].client_id : var.sat_service_principal.client_id | ||
sat_client_secret = local.create_sat_sp ? azuread_service_principal_password.sat[0].value : var.sat_service_principal.client_secret | ||
sat_workspace = module.hub | ||
sat_catalog = var.sat_configuration.enabled ? module.hub_catalog[0] : {} | ||
} | ||
|
||
# ---------------------------------------------------------------------------------------------------------------------- | ||
# Service Principal for SAT | ||
# Note: This is separated from the SAT module to allow for a BYO-SP pattern. If the user supplies values for the | ||
# sat_service principal variable, creation will be skipped. | ||
|
||
resource "azuread_application_registration" "sat" { | ||
count = local.create_sat_sp ? 1 : 0 | ||
|
||
display_name = var.sat_service_principal.name | ||
} | ||
|
||
resource "azuread_service_principal" "sat" { | ||
count = local.create_sat_sp ? 1 : 0 | ||
|
||
client_id = azuread_application_registration.sat[0].client_id | ||
owners = [data.azurerm_client_config.current.object_id] | ||
} | ||
|
||
resource "azuread_service_principal_password" "sat" { | ||
count = local.create_sat_sp ? 1 : 0 | ||
|
||
service_principal_id = azuread_service_principal.sat[0].id | ||
} | ||
|
||
data "azurerm_subscription" "sat" { | ||
count = local.create_sat_sp ? 1 : 0 | ||
|
||
subscription_id = var.subscription_id | ||
} | ||
|
||
resource "azurerm_role_assignment" "sat_can_read_subscription" { | ||
count = local.create_sat_sp ? 1 : 0 | ||
|
||
principal_id = azuread_service_principal.sat[0].object_id | ||
scope = data.azurerm_subscription.sat[0].id | ||
role_definition_name = "Reader" | ||
} | ||
|
||
# ---------------------------------------------------------------------------------------------------------------------- | ||
# This is modularized to allow for easy count and provider arguments | ||
module "sat" { | ||
source = "./modules/sat" | ||
count = var.sat_configuration.enabled ? 1 : 0 | ||
|
||
# Update this as needed | ||
catalog_name = local.sat_catalog.catalog_name | ||
|
||
tenant_id = data.azurerm_client_config.current.tenant_id | ||
subscription_id = var.subscription_id | ||
databricks_account_id = var.databricks_account_id | ||
schema_name = var.sat_configuration.schema_name | ||
proxies = var.sat_configuration.proxies | ||
run_on_serverless = var.sat_configuration.run_on_serverless | ||
service_principal_client_id = local.sat_client_id | ||
service_principal_client_secret = local.sat_client_secret | ||
workspace_id = local.sat_workspace.workspace_id | ||
|
||
depends_on = [local.sat_catalog] | ||
|
||
# Change the provider if needed | ||
providers = { | ||
databricks = databricks.hub | ||
} | ||
} | ||
|
||
# Grant the SP created by SAT the account_admin role | ||
resource "databricks_service_principal_role" "sat_account_admin" { | ||
count = length(module.sat) | ||
|
||
role = "account_admin" | ||
service_principal_id = module.sat[0].service_principal_id | ||
} | ||
|
||
resource "databricks_permission_assignment" "sat_workspace_admin" { | ||
count = length(module.sat) | ||
|
||
permissions = ["ADMIN"] | ||
principal_id = module.sat[0].service_principal_id | ||
|
||
provider = databricks.hub | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT @connorbrown-db Maybe we should consider renaming the SP so that it's non-exclusive to SAT. Future customizations may leverage the same SP together with the SAT deployment