Skip to content

Commit

Permalink
Add .NET 9 support for app service and functions (hashicorp#27880)
Browse files Browse the repository at this point in the history
* Support dotnet 9 for web_app

* Support dotnet 9 for function_app

* Fix linting
  • Loading branch information
JoshWoodArup authored Nov 15, 2024
1 parent 114b4e3 commit 0d268dd
Show file tree
Hide file tree
Showing 18 changed files with 143 additions and 12 deletions.
2 changes: 2 additions & 0 deletions internal/services/appservice/helpers/app_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func windowsApplicationStackSchema() *pluginsdk.Schema {
"v6.0",
"v7.0",
"v8.0",
"v9.0",
}, false),
AtLeastOneOf: windowsApplicationStackConstraint,
},
Expand Down Expand Up @@ -465,6 +466,7 @@ func linuxApplicationStackSchema() *pluginsdk.Schema {
"6.0",
"7.0",
"8.0",
"9.0",
}, false),
ExactlyOneOf: linuxApplicationStackConstraint,
},
Expand Down
10 changes: 6 additions & 4 deletions internal/services/appservice/helpers/function_app_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ func SiteConfigSchemaWindowsFunctionAppComputed() *pluginsdk.Schema {

type ApplicationStackLinuxFunctionApp struct {
// Note - Function Apps differ to Web Apps here. They do not use the named properties in the SiteConfig block and exclusively use the app_settings map
DotNetVersion string `tfschema:"dotnet_version"` // Supported values `3.1`, `6.0`, `7.0` and `8.0`.
DotNetVersion string `tfschema:"dotnet_version"` // Supported values `3.1`, `6.0`, `7.0`, `8.0` and `9.0`.
DotNetIsolated bool `tfschema:"use_dotnet_isolated_runtime"` // Supported values `true` for `dotnet-isolated`, `false` otherwise
NodeVersion string `tfschema:"node_version"` // Supported values `12LTS`, `14LTS`, `16LTS`, `18LTS, `20LTS``
PythonVersion string `tfschema:"python_version"` // Supported values `3.12`, `3.11`, `3.10`, `3.9`, `3.8`, `3.7`
Expand All @@ -1040,7 +1040,7 @@ type ApplicationStackLinuxFunctionApp struct {
}

type ApplicationStackWindowsFunctionApp struct {
DotNetVersion string `tfschema:"dotnet_version"` // Supported values `v3.0`, `v4.0`, `v6.0`, `v7.0` and `v8.0`
DotNetVersion string `tfschema:"dotnet_version"` // Supported values `v3.0`, `v4.0`, `v6.0`, `v7.0`, `v8.0` and `v9.0`
DotNetIsolated bool `tfschema:"use_dotnet_isolated_runtime"` // Supported values `true` for `dotnet-isolated`, `false` otherwise
NodeVersion string `tfschema:"node_version"` // Supported values `12LTS`, `14LTS`, `16LTS`, `18LTS, `20LTS`
JavaVersion string `tfschema:"java_version"` // Supported values `8`, `11`, `17`
Expand Down Expand Up @@ -1071,6 +1071,7 @@ func linuxFunctionAppStackSchema() *pluginsdk.Schema {
"6.0",
"7.0",
"8.0",
"9.0",
}, false),
ExactlyOneOf: []string{
"site_config.0.application_stack.0.dotnet_version",
Expand All @@ -1081,7 +1082,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 .Net. Possible values are `3.1`, `6.0` and `7.0`",
Description: "The version of .Net. Possible values are `3.1`, `6.0`, `7.0`, `8.0` and `9.0`",
},

"use_dotnet_isolated_runtime": {
Expand Down Expand Up @@ -1352,6 +1353,7 @@ func windowsFunctionAppStackSchema() *pluginsdk.Schema {
"v6.0",
"v7.0",
"v8.0",
"v9.0",
}, false),
ExactlyOneOf: []string{
"site_config.0.application_stack.0.dotnet_version",
Expand All @@ -1360,7 +1362,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 version of .Net. Possible values are `v3.0`, `v4.0`, `v6.0` and `v7.0`",
Description: "The version of .Net. Possible values are `v3.0`, `v4.0`, `v6.0`, `v7.0`, `v8.0` and `v9.0`",
},

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

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

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.appStackDotNetIsolated(data, SkuBasicPlan, "9.0"),
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("DOTNET-ISOLATED|9.0"),
),
},
data.ImportStep("site_credential.0.password"),
})
}

func TestAccLinuxFunctionApp_appStackPython(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_linux_function_app", "test")
r := LinuxFunctionAppResource{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,23 @@ func TestAccLinuxFunctionAppSlot_appStackDotNet6Isolated(t *testing.T) {
})
}

func TestAccLinuxFunctionAppSlot_appStackDotNet9Isolated(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test")
r := LinuxFunctionAppSlotResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.appStackDotNetIsolated(data, SkuStandardPlan, "9.0"),
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("DOTNET-ISOLATED|9.0"),
),
},
data.ImportStep("site_credential.0.password"),
})
}

func TestAccLinuxFunctionAppSlot_appStackPython(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test")
r := LinuxFunctionAppSlotResource{}
Expand Down
15 changes: 15 additions & 0 deletions internal/services/appservice/linux_web_app_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,21 @@ func TestAccLinuxWebApp_withDotNet80(t *testing.T) {
})
}

func TestAccLinuxWebApp_withDotNet90(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_linux_web_app", "test")
r := LinuxWebAppResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.dotNet(data, "9.0"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("site_credential.0.password"),
})
}

func TestAccLinuxWebApp_withGo18(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_linux_web_app", "test")
r := LinuxWebAppResource{}
Expand Down
15 changes: 15 additions & 0 deletions internal/services/appservice/linux_web_app_slot_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,21 @@ func TestAccLinuxWebAppSlot_withDotNet80(t *testing.T) {
})
}

func TestAccLinuxWebAppSlot_withDotNet90(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_linux_web_app_slot", "test")
r := LinuxWebAppSlotResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.dotNet(data, "9.0"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("site_credential.0.password"),
})
}

func TestAccLinuxWebAppSlot_withPhp74(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_linux_web_app_slot", "test")
r := LinuxWebAppSlotResource{}
Expand Down
16 changes: 16 additions & 0 deletions internal/services/appservice/windows_function_app_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,22 @@ func TestAccWindowsFunctionApp_appStackDotNet8Isolated(t *testing.T) {
})
}

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

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

func TestAccWindowsFunctionApp_appStackNode(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_windows_function_app", "test")
r := WindowsFunctionAppResource{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,22 @@ func TestAccWindowsFunctionAppSlot_appStackDotNet6Isolated(t *testing.T) {
})
}

func TestAccWindowsFunctionAppSlot_appStackDotNet9Isolated(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_windows_function_app_slot", "test")
r := WindowsFunctionAppSlotResource{}

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

func TestAccWindowsFunctionAppSlot_appStackNode(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_windows_function_app_slot", "test")
r := WindowsFunctionAppSlotResource{}
Expand Down
15 changes: 15 additions & 0 deletions internal/services/appservice/windows_web_app_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,21 @@ func TestAccWindowsWebApp_withDotNet80(t *testing.T) {
})
}

func TestAccWindowsWebApp_withDotNet90(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_windows_web_app", "test")
r := WindowsWebAppResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.dotNet(data, "v9.0"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("site_credential.0.password"),
})
}

func TestAccWindowsWebApp_withPhp(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_windows_web_app", "test")
r := WindowsWebAppResource{}
Expand Down
15 changes: 15 additions & 0 deletions internal/services/appservice/windows_web_app_slot_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,21 @@ func TestAccWindowsWebAppSlot_withDotNet8(t *testing.T) {
})
}

func TestAccWindowsWebAppSlot_withDotNet9(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_windows_web_app_slot", "test")
r := WindowsWebAppSlotResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.dotNet(data, "v9.0"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("site_credential.0.password"),
})
}

func TestAccWindowsWebAppSlot_withPhp74(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_windows_web_app_slot", "test")
r := WindowsWebAppSlotResource{}
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 @@ -172,7 +172,7 @@ A `application_stack` block supports the following:

* `docker` - (Optional) One or more `docker` blocks as defined below.

* `dotnet_version` - (Optional) The version of .NET to use. Possible values include `3.1`, `6.0`, `7.0` and `8.0`.
* `dotnet_version` - (Optional) The version of .NET to use. Possible values include `3.1`, `6.0`, `7.0`, `8.0` and `9.0`.

* `use_dotnet_isolated_runtime` - (Optional) Should the DotNet process use an isolated runtime. Defaults to `false`.

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 @@ -637,7 +637,7 @@ An `application_stack` block supports the following:

* `docker` - (Optional) a `docker` block as detailed below.

* `dotnet_version` - (Optional) The version of .Net. Possible values are `3.1`, `6.0`, `7.0` and `8.0`.
* `dotnet_version` - (Optional) The version of .Net. Possible values are `3.1`, `6.0`, `7.0`, `8.0` and `9.0`.

* `use_dotnet_isolated_runtime` - (Optional) Should the DotNet process use an isolated runtime. Defaults to `false`.

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

~> **NOTE:** `docker_registry_url`, `docker_registry_username`, and `docker_registry_password` replace the use of the `app_settings` values of `DOCKER_REGISTRY_SERVER_URL`, `DOCKER_REGISTRY_SERVER_USERNAME` and `DOCKER_REGISTRY_SERVER_PASSWORD` respectively, these values will be managed by the provider and should not be specified in the `app_settings` map.

* `dotnet_version` - (Optional) The version of .NET to use. Possible values include `3.1`, `5.0`, `6.0`, `7.0` and `8.0`.
* `dotnet_version` - (Optional) The version of .NET to use. Possible values include `3.1`, `5.0`, `6.0`, `7.0`, `8.0` and `9.0`.

* `go_version` - (Optional) The version of Go to use. Possible values include `1.18`, and `1.19`.

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

~> **NOTE:** `docker_registry_url`, `docker_registry_username`, and `docker_registry_password` replace the use of the `app_settings` values of `DOCKER_REGISTRY_SERVER_URL`, `DOCKER_REGISTRY_SERVER_USERNAME` and `DOCKER_REGISTRY_SERVER_PASSWORD` respectively, these values will be managed by the provider and should not be specified in the `app_settings` map.

* `dotnet_version` - (Optional) The version of .NET to use. Possible values include `3.1`, `5.0`, `6.0`, `7.0` and `8.0`.
* `dotnet_version` - (Optional) The version of .NET to use. Possible values include `3.1`, `5.0`, `6.0`, `7.0`, `8.0` and `9.0`.

* `go_version` - (Optional) The version of Go to use. Possible values include `1.18`, and `1.19`.

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 @@ -170,7 +170,7 @@ An `active_directory` block supports the following:

A `application_stack` block supports the following:

* `dotnet_version` - (Optional) The version of .NET to use. Possible values include `v3.0`, `v4.0` `v6.0`, `v7.0` and `v8.0`. Defaults to `v4.0`.
* `dotnet_version` - (Optional) The version of .NET to use. Possible values include `v3.0`, `v4.0` `v6.0`, `v7.0`, `v8.0` and `v9.0`. Defaults to `v4.0`.

* `use_dotnet_isolated_runtime` - (Optional) Should the DotNet process use an isolated runtime. Defaults to `false`.

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 @@ -630,7 +630,7 @@ An `app_service_logs` block supports the following:

An `application_stack` block supports the following:

* `dotnet_version` - (Optional) The version of .Net. Possible values are `v3.0`, `v4.0`, `v6.0`, `v7.0` and `v8.0`. Defaults to `v4.0`.
* `dotnet_version` - (Optional) The version of .Net. Possible values are `v3.0`, `v4.0`, `v6.0`, `v7.0`, `v8.0` and `v9.0`. Defaults to `v4.0`.

* `use_dotnet_isolated_runtime` - (Optional) Should the DotNet process use an isolated runtime. Defaults to `false`.

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

~> **NOTE:** `docker_registry_url`, `docker_registry_username`, and `docker_registry_password` replace the use of the `app_settings` values of `DOCKER_REGISTRY_SERVER_URL`, `DOCKER_REGISTRY_SERVER_USERNAME` and `DOCKER_REGISTRY_SERVER_PASSWORD` respectively, these values will be managed by the provider and should not be specified in the `app_settings` map.

* `dotnet_version` - (Optional) The version of .NET to use when `current_stack` is set to `dotnet`. Possible values include `v2.0`,`v3.0`, `v4.0`, `v5.0`, `v6.0`, `v7.0` and `v8.0`.
* `dotnet_version` - (Optional) The version of .NET to use when `current_stack` is set to `dotnet`. Possible values include `v2.0`,`v3.0`, `v4.0`, `v5.0`, `v6.0`, `v7.0`, `v8.0` and `v9.0`.

~> **NOTE:** The Portal displayed values and the actual underlying API values differ for this setting, as follows:
Portal Value | API value
Expand All @@ -172,6 +172,7 @@ ASP.NET V4.8 | v4.0
.NET 6 (LTS) | v6.0
.NET 7 (STS) | v7.0
.NET 8 (LTS) | v8.0
.NET 9 (STS) | v9.0

* `dotnet_core_version` - (Optional) The version of .NET to use when `current_stack` is set to `dotnetcore`. Possible values include `v4.0`.

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

~> **NOTE:** `docker_registry_url`, `docker_registry_username`, and `docker_registry_password` replace the use of the `app_settings` values of `DOCKER_REGISTRY_SERVER_URL`, `DOCKER_REGISTRY_SERVER_USERNAME` and `DOCKER_REGISTRY_SERVER_PASSWORD` respectively, these values will be managed by the provider and should not be specified in the `app_settings` map.

* `dotnet_version` - (Optional) The version of .NET to use when `current_stack` is set to `dotnet`. Possible values include `v2.0`,`v3.0`, `v4.0`, `v5.0`, `v6.0`, `v7.0` and `v8.0`.
* `dotnet_version` - (Optional) The version of .NET to use when `current_stack` is set to `dotnet`. Possible values include `v2.0`,`v3.0`, `v4.0`, `v5.0`, `v6.0`, `v7.0`, `v8.0` and `v9.0`.

* `dotnet_core_version` - (Optional) The version of .NET to use when `current_stack` is set to `dotnetcore`. Possible values include `v4.0`.

Expand Down

0 comments on commit 0d268dd

Please sign in to comment.