Skip to content

Commit

Permalink
Merge pull request #25919 from favoretti/favoretti/databricks_default…
Browse files Browse the repository at this point in the history
…_storage_firewall

`azurerm_databricks_workspace`: Add support for `default_storage_firewall_enabled` property
  • Loading branch information
manicminer authored May 11, 2024
2 parents 9c38efc + 6b6ce75 commit f635be3
Show file tree
Hide file tree
Showing 75 changed files with 677 additions and 100 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ require (
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.4.0
github.com/hashicorp/go-azure-helpers v0.69.0
github.com/hashicorp/go-azure-sdk/resource-manager v0.20240506.1094936
github.com/hashicorp/go-azure-sdk/sdk v0.20240506.1094936
github.com/hashicorp/go-azure-sdk/resource-manager v0.20240507.1095453
github.com/hashicorp/go-azure-sdk/sdk v0.20240507.1095453
github.com/hashicorp/go-hclog v1.5.0
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-uuid v1.0.3
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-azure-helpers v0.69.0 h1:JwUWXyDgyr6OafU4CgSvrbEP1wcMjfz4gxRQciDQkBQ=
github.com/hashicorp/go-azure-helpers v0.69.0/go.mod h1:BmbF4JDYXK5sEmFeU5hcn8Br21uElcqLfdQxjatwQKw=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20240506.1094936 h1:7Y8i1HYjupSg1yYDosrrfc1fLCxdYUEzrBIedKwJeFs=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20240506.1094936/go.mod h1:p1P+kBwN54NLKGg35s5O7sBoFP3Zk60nBTA5PsOqFus=
github.com/hashicorp/go-azure-sdk/sdk v0.20240506.1094936 h1:a7vuK6yajMRRpONXqOYOl0dE4TRIjzV8Rw5SFlUlYgw=
github.com/hashicorp/go-azure-sdk/sdk v0.20240506.1094936/go.mod h1:Ts5vRL3KPw8iLit+4WSi1hOWlRCx++wJrCkMGj69xBY=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20240507.1095453 h1:6nCJQT1WCzjVZ1dljs7RKVPiscy0V3DnNvfxBIYNm7Y=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20240507.1095453/go.mod h1:CDmjXxvqpnFrRAX5xAKczebKevwO2C7HELMygEeX4ss=
github.com/hashicorp/go-azure-sdk/sdk v0.20240507.1095453 h1:HHrx24Kjo0diFIjAxlaS8KVB9rO99QMYaQ/tkKqRA1I=
github.com/hashicorp/go-azure-sdk/sdk v0.20240507.1095453/go.mod h1:Ts5vRL3KPw8iLit+4WSi1hOWlRCx++wJrCkMGj69xBY=
github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU=
github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
Expand Down
4 changes: 2 additions & 2 deletions internal/services/databricks/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-10-01-preview/accessconnector"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/vnetpeering"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/vnetpeering"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/workspaces"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/workspaces"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/locks"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/workspaces"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/workspaces"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/locks"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/workspaces"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/vnetpeering"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/vnetpeering"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/workspaces"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/locks"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/vnetpeering"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/vnetpeering"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/workspaces"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/timeouts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/workspaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/privateendpoints"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
Expand Down
70 changes: 65 additions & 5 deletions internal/services/databricks/databricks_workspace_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-10-01-preview/accessconnector"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/workspaces"
mlworkspace "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2023-10-01/workspaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/loadbalancers"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
Expand Down Expand Up @@ -126,6 +127,18 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource {
Default: true,
},

"default_storage_firewall_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
RequiredWith: []string{"access_connector_id"},
},

"access_connector_id": {
Type: pluginsdk.TypeString,
Optional: true,
RequiredWith: []string{"default_storage_firewall_enabled"},
},

"network_security_group_rules_required": {
Type: pluginsdk.TypeString,
Optional: true,
Expand Down Expand Up @@ -326,6 +339,7 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource {

CustomizeDiff: pluginsdk.CustomizeDiffShim(func(ctx context.Context, d *pluginsdk.ResourceDiff, v interface{}) error {
_, customerEncryptionEnabled := d.GetChange("customer_managed_key_enabled")
_, defaultStorageFirewallEnabled := d.GetChange("default_storage_firewall_enabled")
_, infrastructureEncryptionEnabled := d.GetChange("infrastructure_encryption_enabled")
_, publicNetworkAccess := d.GetChange("public_network_access_enabled")
_, requireNsgRules := d.GetChange("network_security_group_rules_required")
Expand Down Expand Up @@ -357,8 +371,8 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource {
}
}

if (customerEncryptionEnabled.(bool) || infrastructureEncryptionEnabled.(bool) || managedServicesCMK.(string) != "" || managedDiskCMK.(string) != "") && !strings.EqualFold("premium", newSku.(string)) {
return fmt.Errorf("'customer_managed_key_enabled', 'infrastructure_encryption_enabled', 'managed_disk_cmk_key_vault_key_id' and 'managed_services_cmk_key_vault_key_id' are only available with a 'premium' workspace 'sku', got %q", newSku)
if (customerEncryptionEnabled.(bool) || defaultStorageFirewallEnabled.(bool) || infrastructureEncryptionEnabled.(bool) || managedServicesCMK.(string) != "" || managedDiskCMK.(string) != "") && !strings.EqualFold("premium", newSku.(string)) {
return fmt.Errorf("'customer_managed_key_enabled', 'default_storage_firewall_enabled', 'infrastructure_encryption_enabled', 'managed_disk_cmk_key_vault_key_id' and 'managed_services_cmk_key_vault_key_id' are only available with a 'premium' workspace 'sku', got %q", newSku)
}

return nil
Expand All @@ -368,6 +382,7 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource {

func resourceDatabricksWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).DataBricks.WorkspacesClient
acClient := meta.(*clients.Client).DataBricks.AccessConnectorClient
lbClient := meta.(*clients.Client).LoadBalancers.LoadBalancersClient
keyVaultsClient := meta.(*clients.Client).KeyVault
subscriptionId := meta.(*clients.Client).Account.SubscriptionId
Expand Down Expand Up @@ -433,6 +448,11 @@ func resourceDatabricksWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta int
managedResourceGroupID := resourcesParse.NewResourceGroupID(subscriptionId, managedResourceGroupName).ID()
customerEncryptionEnabled := d.Get("customer_managed_key_enabled").(bool)
infrastructureEncryptionEnabled := d.Get("infrastructure_encryption_enabled").(bool)
defaultStorageFirewallEnabledRaw := d.Get("default_storage_firewall_enabled").(bool)
defaultStorageFirewallEnabled := workspaces.DefaultStorageFirewallDisabled
if defaultStorageFirewallEnabledRaw {
defaultStorageFirewallEnabled = workspaces.DefaultStorageFirewallEnabled
}
publicNetowrkAccessRaw := d.Get("public_network_access_enabled").(bool)
publicNetworkAccess := workspaces.PublicNetworkAccessDisabled
if publicNetowrkAccessRaw {
Expand Down Expand Up @@ -578,6 +598,41 @@ func resourceDatabricksWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta int
Tags: tags.Expand(d.Get("tags").(map[string]interface{})),
}

if defaultStorageFirewallEnabledRaw {
accessConnectorProperties := workspaces.WorkspacePropertiesAccessConnector{}
accessConnectorIdRaw := d.Get("access_connector_id").(string)
accessConnectorId, err := accessconnector.ParseAccessConnectorID(accessConnectorIdRaw)

if err != nil {
return fmt.Errorf("parsing Access Connector ID %s: %+v", accessConnectorIdRaw, err)
}

accessConnector, err := acClient.Get(ctx, *accessConnectorId)
if err != nil {
return fmt.Errorf("retrieving Access Connector %s: %+v", accessConnectorId.AccessConnectorName, err)
}

if accessConnector.Model.Identity != nil {

accIdentityId := ""
for raw := range accessConnector.Model.Identity.IdentityIds {
id, err := commonids.ParseUserAssignedIdentityIDInsensitively(raw)
if err != nil {
return fmt.Errorf("parsing %q as a User Assigned Identity ID: %+v", raw, err)
}
accIdentityId = id.ID()
break
}

accessConnectorProperties.Id = *accessConnector.Model.Id
accessConnectorProperties.IdentityType = workspaces.IdentityType(accessConnector.Model.Identity.Type)
accessConnectorProperties.UserAssignedIdentityId = &accIdentityId
}

workspace.Properties.AccessConnector = &accessConnectorProperties
workspace.Properties.DefaultStorageFirewall = &defaultStorageFirewallEnabled
}

if requireNsgRules != "" {
requiredNsgRulesConst := workspaces.RequiredNsgRules(requireNsgRules)
workspace.Properties.RequiredNsgRules = &requiredNsgRulesConst
Expand Down Expand Up @@ -677,6 +732,11 @@ func resourceDatabricksWorkspaceRead(d *pluginsdk.ResourceData, meta interface{}
d.Set("managed_resource_group_id", model.Properties.ManagedResourceGroupId)
d.Set("managed_resource_group_name", managedResourceGroupID.ResourceGroup)

if defaultStorageFirewall := model.Properties.DefaultStorageFirewall; defaultStorageFirewall != nil {
d.Set("default_storage_firewall_enabled", *defaultStorageFirewall != workspaces.DefaultStorageFirewallDisabled)
d.Set("access_connector_id", model.Properties.AccessConnector.Id)
}

publicNetworkAccess := model.Properties.PublicNetworkAccess
if publicNetworkAccess != nil {
d.Set("public_network_access_enabled", *publicNetworkAccess != workspaces.PublicNetworkAccessDisabled)
Expand Down Expand Up @@ -790,7 +850,7 @@ func resourceDatabricksWorkspaceDelete(d *pluginsdk.ResourceData, meta interface
return err
}

if err = client.DeleteThenPoll(ctx, *id); err != nil {
if err = client.DeleteThenPoll(ctx, *id, workspaces.DeleteOperationOptions{}); err != nil {
return fmt.Errorf("deleting %s: %+v", *id, err)
}

Expand Down Expand Up @@ -976,7 +1036,7 @@ func expandWorkspaceCustomParameters(input []interface{}, customerManagedKeyEnab
}

if v, ok := config["no_public_ip"].(bool); ok {
parameters.EnableNoPublicIP = &workspaces.WorkspaceCustomBooleanParameter{
parameters.EnableNoPublicIP = &workspaces.WorkspaceNoPublicIPBooleanParameter{
Value: v,
}
}
Expand Down
127 changes: 126 additions & 1 deletion internal/services/databricks/databricks_workspace_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strings"
"testing"

"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/workspaces"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down Expand Up @@ -40,6 +40,21 @@ func TestAccDatabricksWorkspace_basic(t *testing.T) {
})
}

func TestAccDatabricksWorkspace_defaultStorageFirewall(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_databricks_workspace", "test")
r := DatabricksWorkspaceResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.defaultStorageFirewall(data, "premium"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("custom_parameters.0.public_subnet_network_security_group_association_id", "custom_parameters.0.private_subnet_network_security_group_association_id"),
})
}

func TestAccDatabricksWorkspace_sameName(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_databricks_workspace", "test")
r := DatabricksWorkspaceResource{}
Expand Down Expand Up @@ -442,6 +457,116 @@ resource "azurerm_databricks_workspace" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, sku)
}

func (DatabricksWorkspaceResource) defaultStorageFirewall(data acceptance.TestData, sku string) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-databricks-%[1]d"
location = "%[2]s"
}
resource "azurerm_virtual_network" "test" {
name = "acctest-vnet-%[1]d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
address_space = ["10.0.0.0/16"]
}
resource "azurerm_subnet" "public" {
name = "acctest-sn-public-%[1]d"
resource_group_name = azurerm_resource_group.test.name
virtual_network_name = azurerm_virtual_network.test.name
address_prefixes = ["10.0.1.0/24"]
delegation {
name = "acctest"
service_delegation {
name = "Microsoft.Databricks/workspaces"
actions = [
"Microsoft.Network/virtualNetworks/subnets/join/action",
"Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
"Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action",
]
}
}
}
resource "azurerm_subnet" "private" {
name = "acctest-sn-private-%[1]d"
resource_group_name = azurerm_resource_group.test.name
virtual_network_name = azurerm_virtual_network.test.name
address_prefixes = ["10.0.2.0/24"]
delegation {
name = "acctest"
service_delegation {
name = "Microsoft.Databricks/workspaces"
actions = [
"Microsoft.Network/virtualNetworks/subnets/join/action",
"Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
"Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action",
]
}
}
}
resource "azurerm_network_security_group" "nsg" {
name = "acctest-nsg-private-%[1]d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
}
resource "azurerm_subnet_network_security_group_association" "public" {
subnet_id = azurerm_subnet.public.id
network_security_group_id = azurerm_network_security_group.nsg.id
}
resource "azurerm_subnet_network_security_group_association" "private" {
subnet_id = azurerm_subnet.private.id
network_security_group_id = azurerm_network_security_group.nsg.id
}
resource "azurerm_databricks_access_connector" "test" {
name = "acctestDBWACC%[1]d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
identity {
type = "SystemAssigned"
}
}
resource "azurerm_databricks_workspace" "test" {
name = "acctestDBW-%[1]d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
sku = "%[3]s"
custom_parameters {
no_public_ip = false
public_subnet_name = azurerm_subnet.public.name
private_subnet_name = azurerm_subnet.private.name
virtual_network_id = azurerm_virtual_network.test.id
public_subnet_network_security_group_association_id = azurerm_subnet_network_security_group_association.public.id
private_subnet_network_security_group_association_id = azurerm_subnet_network_security_group_association.private.id
}
access_connector_id = azurerm_databricks_access_connector.test.id
default_storage_firewall_enabled = true
}
`, data.RandomInteger, data.Locations.Primary, sku)
}

func (DatabricksWorkspaceResource) sameName(data acceptance.TestData, sku string) string {
return fmt.Sprintf(`
provider "azurerm" {
Expand Down
Loading

0 comments on commit f635be3

Please sign in to comment.