Skip to content

Commit

Permalink
azurerm_databricks_workspace - update default value for `no_public_…
Browse files Browse the repository at this point in the history
…ip` to `true` in v4.0 of the provider (#26589)

* Initial Check-in...

* Revert code to keep v3.104.0 provider behavior...

* Update documentation...

* Address PR comments...
  • Loading branch information
WodansSon authored Jul 12, 2024
1 parent 6520156 commit 1f916d7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
19 changes: 15 additions & 4 deletions internal/services/databricks/databricks_workspace_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
)

func resourceDatabricksWorkspace() *pluginsdk.Resource {
return &pluginsdk.Resource{
resource := &pluginsdk.Resource{
Create: resourceDatabricksWorkspaceCreateUpdate,
Read: resourceDatabricksWorkspaceRead,
Update: resourceDatabricksWorkspaceCreateUpdate,
Expand Down Expand Up @@ -186,7 +186,7 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource {
"no_public_ip": {
Type: pluginsdk.TypeBool,
Optional: true,
Computed: true,
Default: true,
AtLeastOneOf: workspaceCustomParametersString(),
},

Expand Down Expand Up @@ -243,10 +243,8 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource {
AtLeastOneOf: workspaceCustomParametersString(),
},

// Per Service Team: This field is actually changeable so the ForceNew is no longer required, however we agreed to not change the current behavior for consistency purposes
"storage_account_sku_name": {
Type: pluginsdk.TypeString,
ForceNew: true,
Optional: true,
Computed: true,
AtLeastOneOf: workspaceCustomParametersString(),
Expand Down Expand Up @@ -381,6 +379,19 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource {
return nil
}),
}

if !features.FourPointOhBeta() {
// NOTE: Leaving this as O+C as the 2024-05-01 API breaking change was accidentally introduced in PR #25919
// and released in v3.104.0 of the provider...
resource.Schema["custom_parameters"].Elem.(*pluginsdk.Resource).Schema["no_public_ip"] = &pluginsdk.Schema{
Type: pluginsdk.TypeBool,
Optional: true,
Computed: true,
AtLeastOneOf: workspaceCustomParametersString(),
}
}

return resource
}

func resourceDatabricksWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,7 @@ resource "azurerm_databricks_workspace" "test" {
sku = "%[3]s"
custom_parameters {
no_public_ip = false
machine_learning_workspace_id = azurerm_machine_learning_workspace.test.id
}
}
Expand Down
6 changes: 4 additions & 2 deletions website/docs/r/databricks_workspace.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ A `custom_parameters` block supports the following:

* `no_public_ip` - (Optional) Are public IP Addresses not allowed? Possible values are `true` or `false`. Defaults to `false`.

~> **Note:** Updating `no_public_ip` parameter is only allowed if the value is changing from `false` to `true` and and only for VNet-injected workspaces.
~> **Note:** Updating `no_public_ip` parameter is only allowed if the value is changing from `false` to `true` and only for VNet-injected workspaces.

~> **Note:** In `v3.104.0` and higher of the provider the `no_public_ip` parameter will now default to `true` instead of `false`.

* `public_subnet_name` - (Optional) The name of the Public Subnet within the Virtual Network. Required if `virtual_network_id` is set. Changing this forces a new resource to be created.

Expand All @@ -112,7 +114,7 @@ A `custom_parameters` block supports the following:

* `storage_account_name` - (Optional) Default Databricks File Storage account name. Defaults to a randomized name(e.g. `dbstoragel6mfeghoe5kxu`). Changing this forces a new resource to be created.

* `storage_account_sku_name` - (Optional) Storage account SKU name. Possible values include `Standard_LRS`, `Standard_GRS`, `Standard_RAGRS`, `Standard_GZRS`, `Standard_RAGZRS`, `Standard_ZRS`, `Premium_LRS` or `Premium_ZRS`. Defaults to `Standard_GRS`. Changing this forces a new resource to be created.
* `storage_account_sku_name` - (Optional) Storage account SKU name. Possible values include `Standard_LRS`, `Standard_GRS`, `Standard_RAGRS`, `Standard_GZRS`, `Standard_RAGZRS`, `Standard_ZRS`, `Premium_LRS` or `Premium_ZRS`. Defaults to `Standard_GRS`.

* `virtual_network_id` - (Optional) The ID of a Virtual Network where this Databricks Cluster should be created. Changing this forces a new resource to be created.

Expand Down

0 comments on commit 1f916d7

Please sign in to comment.