Skip to content

Commit 45d2a9b

Browse files
authored
azurerm_synapse_spark_pool/azurerm_synapse_workspace- fix acctests (hashicorp#30168)
1 parent 6fdf075 commit 45d2a9b

5 files changed

Lines changed: 30 additions & 14 deletions

File tree

internal/services/synapse/synapse_spark_pool_resource.go

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/Azure/azure-sdk-for-go/services/preview/synapse/mgmt/v2.0/synapse" // nolint: staticcheck
1212
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
1313
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
14+
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
1415
"github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/parse"
1516
"github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/validate"
1617
"github.com/hashicorp/terraform-provider-azurerm/internal/tags"
@@ -21,7 +22,7 @@ import (
2122
)
2223

2324
func resourceSynapseSparkPool() *pluginsdk.Resource {
24-
return &pluginsdk.Resource{
25+
r := &pluginsdk.Resource{
2526
Create: resourceSynapseSparkPoolCreate,
2627
Read: resourceSynapseSparkPoolRead,
2728
Update: resourceSynapseSparkPoolUpdate,
@@ -216,15 +217,34 @@ func resourceSynapseSparkPool() *pluginsdk.Resource {
216217
Type: pluginsdk.TypeString,
217218
Required: true,
218219
ValidateFunc: validation.StringInSlice([]string{
219-
"3.2",
220-
"3.3",
221220
"3.4",
222221
}, false),
223222
},
224223

225224
"tags": tags.Schema(),
226225
},
227226
}
227+
228+
if !features.FivePointOh() {
229+
r.Schema["spark_version"] = &pluginsdk.Schema{
230+
Type: pluginsdk.TypeString,
231+
Required: true,
232+
ValidateFunc: validation.All(validation.StringInSlice([]string{
233+
"3.2",
234+
"3.3",
235+
"3.4",
236+
}, false),
237+
func(v interface{}, k string) (warnings []string, errors []error) {
238+
if val, ok := v.(string); ok && (val == "3.2" || val == "3.3") {
239+
warnings = append(warnings, fmt.Sprintf("Spark version %s is deprecated and will be removed in a future version of the AzureRM provider. Please consider upgrading to version 3.4 or later.", val))
240+
}
241+
return
242+
},
243+
),
244+
}
245+
}
246+
247+
return r
228248
}
229249

230250
func resourceSynapseSparkPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error {

internal/services/synapse/synapse_spark_pool_resource_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,6 @@ func TestAccSynapseSparkPool_sparkVersion(t *testing.T) {
9999
r := SynapseSparkPoolResource{}
100100

101101
data.ResourceTest(t, r, []acceptance.TestStep{
102-
{
103-
Config: r.sparkVersion(data, "3.2"),
104-
Check: acceptance.ComposeTestCheckFunc(
105-
check.That(data.ResourceName).ExistsInAzure(r),
106-
),
107-
},
108-
// not returned by service
109-
data.ImportStep("spark_events_folder", "spark_log_folder"),
110102
{
111103
Config: r.sparkVersion(data, "3.3"),
112104
Check: acceptance.ComposeTestCheckFunc(

internal/services/synapse/synapse_workspace_resource_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ func TestAccSynapseWorkspace_update(t *testing.T) {
9898
Check: acceptance.ComposeTestCheckFunc(
9999
check.That(data.ResourceName).ExistsInAzure(r),
100100
),
101+
ExpectNonEmptyPlan: true, // removing workspace AAD admin also removes the SQL AAD admin and visa versa so it needs to be recreated
101102
},
102-
data.ImportStep("sql_administrator_login_password"),
103103
{
104104
Config: r.basic(data),
105105
Check: acceptance.ComposeTestCheckFunc(
@@ -353,7 +353,7 @@ resource "azurerm_synapse_workspace" "test" {
353353
ENV = "Test"
354354
}
355355
}
356-
`, template, data.RandomString, data.Locations.Secondary, data.RandomString, data.RandomString, data.RandomInteger, data.RandomInteger)
356+
`, template, data.RandomString, data.Locations.Ternary, data.RandomString, data.RandomString, data.RandomInteger, data.RandomInteger)
357357
}
358358

359359
func (r SynapseWorkspaceResource) withAadAdmin(data acceptance.TestData) string {

website/docs/5.0-upgrade-guide.html.markdown

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,10 @@ Please follow the format in the example below for listing breaking changes in re
379379
* The deprecated `static_website` block has been removed and superseded by the `azurerm_storage_account_static_website` resource.
380380
* The property `minimum_tls_version` no longer accepts `TLS1_0` or `TLS1_1` as a value.
381381

382+
### `azurerm_synapse_spark_pool`
383+
384+
* The `spark_version` property no longer accepts `3.2` or `3.3` as a value.
385+
382386
### `azurerm_storage_container`
383387

384388
* The deprecated `storage_account_name` property has been removed in favour of the `storage_account_id` property.

website/docs/r/synapse_spark_pool.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ The following arguments are supported:
9797

9898
* `node_size` - (Required) The level of node in the Spark Pool. Possible values are `Small`, `Medium`, `Large`, `None`, `XLarge`, `XXLarge` and `XXXLarge`.
9999

100-
* `spark_version` - (Required) The Apache Spark version. Possible values are `3.2`, `3.3`, and `3.4`.
100+
* `spark_version` - (Required) The Apache Spark version. Currently, the only possible value is `3.4`.
101101

102102
* `node_count` - (Optional) The number of nodes in the Spark Pool. Exactly one of `node_count` or `auto_scale` must be specified.
103103

0 commit comments

Comments
 (0)