Skip to content

Commit

Permalink
Adding support for PowerShell 7.4 (#25980)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chambras committed May 15, 2024
1 parent 396e457 commit 4296848
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 9 deletions.
12 changes: 7 additions & 5 deletions internal/services/appservice/helpers/function_app_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,9 @@ func linuxFunctionAppStackSchema() *pluginsdk.Schema {
Type: pluginsdk.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
"7", // Deprecated / not available in the portal
"7.2",
"7", // Deprecated / not available in the portal
"7.2", // preview LTS Support
"7.4", // current LTS Support
}, false),
ExactlyOneOf: []string{
"site_config.0.application_stack.0.dotnet_version",
Expand All @@ -1135,7 +1136,7 @@ func linuxFunctionAppStackSchema() *pluginsdk.Schema {
"site_config.0.application_stack.0.docker",
"site_config.0.application_stack.0.use_custom_runtime",
},
Description: "The version of PowerShell Core to use. Possibles values are `7`, and `7.2`",
Description: "The version of PowerShell Core to use. Possibles values are `7`, `7.2`, and `7.4`",
},

"java_version": {
Expand Down Expand Up @@ -1392,8 +1393,9 @@ func windowsFunctionAppStackSchema() *pluginsdk.Schema {
Type: pluginsdk.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
"7",
"7", // Deprecated / not available in the portal
"7.2", // preview LTS Support
"7.4", // current LTS Support
}, false),
ExactlyOneOf: []string{
"site_config.0.application_stack.0.dotnet_version",
Expand All @@ -1402,7 +1404,7 @@ func windowsFunctionAppStackSchema() *pluginsdk.Schema {
"site_config.0.application_stack.0.powershell_core_version",
"site_config.0.application_stack.0.use_custom_runtime",
},
Description: "The PowerShell Core version to use. Possible values are `7`, and `7.2`",
Description: "The PowerShell Core version to use. Possible values are `7`, `7.2`, and `7.4`",
},

"use_custom_runtime": {
Expand Down
20 changes: 20 additions & 0 deletions internal/services/appservice/linux_function_app_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,23 @@ func TestAccLinuxFunctionApp_appStackPowerShellCore72(t *testing.T) {
})
}

func TestAccLinuxFunctionApp_appStackPowerShellCore74(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_linux_function_app", "test")
r := LinuxFunctionAppResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.appStackPowerShellCore(data, SkuBasicPlan, "7.4"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("kind").HasValue("functionapp,linux"),
check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("POWERSHELL|7.4"),
),
},
data.ImportStep("site_credential.0.password"),
})
}

// (@jackofallops) - The portal does not allow the active stack to be changed currently, however, the API accepts it and the changes are reflected in the portal.
func TestAccLinuxFunctionApp_appStackUpdate(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_linux_function_app", "test")
Expand Down Expand Up @@ -2918,6 +2935,9 @@ resource "azurerm_linux_function_app" "test" {
powershell_core_version = "%s"
}
}
ftp_publish_basic_authentication_enabled = false
webdeploy_publish_basic_authentication_enabled = false
}
`, r.template(data, planSku), data.RandomInteger, version)
}
Expand Down
19 changes: 19 additions & 0 deletions internal/services/appservice/windows_function_app_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,22 @@ func TestAccWindowsFunctionApp_appStackPowerShellCore72(t *testing.T) {
})
}

func TestAccWindowsFunctionApp_appStackPowerShellCore74(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_windows_function_app", "test")
r := WindowsFunctionAppResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.appStackPowerShellCore(data, SkuBasicPlan, "7.4"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("kind").HasValue("functionapp"),
),
},
data.ImportStep("site_credential.0.password"),
})
}

// Others

func TestAccWindowsFunctionApp_updateServicePlan(t *testing.T) {
Expand Down Expand Up @@ -2981,6 +2997,9 @@ resource "azurerm_windows_function_app" "test" {
powershell_core_version = "%s"
}
}
ftp_publish_basic_authentication_enabled = false
webdeploy_publish_basic_authentication_enabled = false
}
`, r.template(data, planSku), data.RandomInteger, version)
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/linux_function_app.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ A `application_stack` block supports the following:

* `python_version` - (Optional) The version of Python to run. Possible values are `3.12`, `3.11`, `3.10`, `3.9`, `3.8` and `3.7`.

* `powershell_core_version` - (Optional) The version of PowerShell Core to run. Possible values are `7`, and `7.2`.
* `powershell_core_version` - (Optional) The version of PowerShell Core to run. Possible values are `7`, `7.2`, and `7.4`.

* `use_custom_runtime` - (Optional) Should the Linux Function App use a custom runtime?

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/linux_function_app_slot.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ An `application_stack` block supports the following:

* `node_version` - (Optional) The version of Node to use. Possible values include `12`, `14`, `16`, `18` and `20`

* `powershell_core_version` - (Optional) The version of PowerShell Core to use. Possibles values are `7` , and `7.2`.
* `powershell_core_version` - (Optional) The version of PowerShell Core to use. Possibles values are `7` , `7.2`, and `7.4`.

* `python_version` - (Optional) The version of Python to use. Possible values are `3.12`, `3.11`, `3.10`, `3.9`, `3.8` and `3.7`.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/windows_function_app.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ A `application_stack` block supports the following:

* `node_version` - (Optional) The version of Node to run. Possible values include `~12`, `~14`, `~16`, `~18` and `~20`.

* `powershell_core_version` - (Optional) The version of PowerShell Core to run. Possible values are `7`, and `7.2`.
* `powershell_core_version` - (Optional) The version of PowerShell Core to run. Possible values are `7`, `7.2`, and `7.4`.

~> **NOTE:** A value of `7` will provide the latest stable version. `7.2` is in preview at the time of writing.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/windows_function_app_slot.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ An `application_stack` block supports the following:

* `node_version` - (Optional) The version of Node to use. Possible values are `~12`, `~14`, `~16`, `~18` and `~20`.

* `powershell_core_version` - (Optional) The PowerShell Core version to use. Possible values are `7`, and `7.2`.
* `powershell_core_version` - (Optional) The PowerShell Core version to use. Possible values are `7`, `7.2`, and `7.4`.

* `use_custom_runtime` - (Optional) Does the Function App use a custom Application Stack?

Expand Down

0 comments on commit 4296848

Please sign in to comment.