Skip to content
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

azurerm_synapse_spark_pool - spark_version now supports 3.0 #11972

Merged
merged 1 commit into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func resourceSynapseSparkPool() *pluginsdk.Resource {
Default: "2.4",
ValidateFunc: validation.StringInSlice([]string{
"2.4",
"3.0",
}, false),
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestAccSynapseSparkPool_complete(t *testing.T) {

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.complete(data),
Config: r.complete(data, "2.4"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
Expand All @@ -75,7 +75,52 @@ func TestAccSynapseSparkPool_update(t *testing.T) {
},
data.ImportStep("spark_events_folder", "spark_log_folder"),
{
Config: r.complete(data),
Config: r.complete(data, "2.4"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("spark_events_folder", "spark_log_folder"),
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("spark_events_folder", "spark_log_folder"),
})
}

func TestAccSynapseSpark3Pool_complete(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_synapse_spark_pool", "test")
r := SynapseSparkPoolResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.complete(data, "3.0"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// not returned by service
data.ImportStep("spark_events_folder", "spark_log_folder"),
})
}

func TestAccSynapseSpark3Pool_update(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_synapse_spark_pool", "test")
r := SynapseSparkPoolResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("spark_events_folder", "spark_log_folder"),
{
Config: r.complete(data, "3.0"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
Expand Down Expand Up @@ -138,7 +183,7 @@ resource "azurerm_synapse_spark_pool" "import" {
`, config)
}

func (r SynapseSparkPoolResource) complete(data acceptance.TestData) string {
func (r SynapseSparkPoolResource) complete(data acceptance.TestData, sparkVersion string) string {
template := r.template(data)
return fmt.Sprintf(`
%s
Expand Down Expand Up @@ -168,13 +213,13 @@ EOF

spark_log_folder = "/logs"
spark_events_folder = "/events"
spark_version = "2.4"
spark_version = "%s"

tags = {
ENV = "Test"
}
}
`, template, data.RandomString)
`, template, data.RandomString, sparkVersion)
}

func (r SynapseSparkPoolResource) template(data acceptance.TestData) string {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/synapse_spark_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ The following arguments are supported:

* `spark_events_folder` - (Optional) The Spark events folder. Defaults to `/events`.

* `spark_version` - (Optional) The Apache Spark version. Possible value is `2.4`. Defaults to `2.4`.
* `spark_version` - (Optional) The Apache Spark version. Possible values are `2.4` and `3.0`. Defaults to `2.4`.

* `tags` - (Optional) A mapping of tags which should be assigned to the Synapse Spark Pool.

Expand Down