From 06dceef0e2f6fc0fc20d4c57339e5dd907235ff2 Mon Sep 17 00:00:00 2001 From: "Marvin B. Lillehaug" Date: Tue, 11 Jun 2024 14:58:22 +0200 Subject: [PATCH] Allow java_version 21 for app services and functions. fixes #25490, #24754 --- CHANGELOG.md | 4 ++ .../services/appservice/helpers/app_stack.go | 1 + .../appservice/helpers/function_app_schema.go | 10 +++-- .../appservice/linux_web_app_resource_test.go | 34 +++++++++++++++++ .../services/web/app_service_resource_test.go | 37 +++++++++++++++++++ website/docs/r/function_app.html.markdown | 2 +- .../docs/r/function_app_slot.html.markdown | 2 +- .../docs/r/linux_function_app.html.markdown | 2 +- .../r/linux_function_app_slot.html.markdown | 2 +- website/docs/r/linux_web_app.html.markdown | 2 +- .../docs/r/linux_web_app_slot.html.markdown | 2 +- .../docs/r/windows_function_app.html.markdown | 2 +- .../r/windows_function_app_slot.html.markdown | 2 +- .../docs/r/windows_web_app_slot.html.markdown | 2 +- 14 files changed, 91 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2ecc4d8c50e5..46d983437d401 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ ENHANCEMENTS: * provider: support subscription ID hinting when using Azure CLI authentication [GH-26282] * `azurerm_kubernetes_cluster` - updating `network_profile.network_policy` to `azure` and `calico` when it hasn't been previously set is supported [GH-26176] * `azurerm_kubernetes_cluster` - respect Pod Distruption Budgets when rotating the `default_node_pool` [GH-26274] +* `azurerm_linux_web_app` - Support Java 21. ([#25490](https://github.com/hashicorp/terraform-provider-azurerm/issues/25490)) +* `azurerm_windows_web_app` - Support Java 21. ([#25490](https://github.com/hashicorp/terraform-provider-azurerm/issues/25490)) +* `azurerm_linux_function_app` - Support Java 21. ([#25490](https://github.com/hashicorp/terraform-provider-azurerm/issues/25490)) +* `azurerm_windows_function_app` - Support Java 21. ([#25490](https://github.com/hashicorp/terraform-provider-azurerm/issues/25490)) BUG FIXES: * `azurerm_express_route_circuit_peering`, `azurerm_express_route_circuit`, `azurerm_express_route_gateway`, `azurerm_express_route_port` - split create and update [GH-26237] diff --git a/internal/services/appservice/helpers/app_stack.go b/internal/services/appservice/helpers/app_stack.go index 777f5e896acdf..db6b5e30d16b3 100644 --- a/internal/services/appservice/helpers/app_stack.go +++ b/internal/services/appservice/helpers/app_stack.go @@ -536,6 +536,7 @@ func linuxApplicationStackSchema() *pluginsdk.Schema { "8", "11", "17", + "21", }, false), ExactlyOneOf: linuxApplicationStackConstraint, RequiredWith: []string{ diff --git a/internal/services/appservice/helpers/function_app_schema.go b/internal/services/appservice/helpers/function_app_schema.go index b2517a4611cb9..76582b9e6f6d0 100644 --- a/internal/services/appservice/helpers/function_app_schema.go +++ b/internal/services/appservice/helpers/function_app_schema.go @@ -1034,7 +1034,7 @@ type ApplicationStackLinuxFunctionApp struct { 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` PowerShellCoreVersion string `tfschema:"powershell_core_version"` // Supported values are `7.0`, `7.2` - JavaVersion string `tfschema:"java_version"` // Supported values `8`, `11`, `17` + JavaVersion string `tfschema:"java_version"` // Supported values `8`, `11`, `17`, `21` CustomHandler bool `tfschema:"use_custom_runtime"` // Supported values `true` Docker []ApplicationStackDocker `tfschema:"docker"` // Needs ElasticPremium or Basic (B1) Standard (S 1-3) or Premium(PxV2 or PxV3) LINUX Service Plan } @@ -1043,7 +1043,7 @@ type ApplicationStackWindowsFunctionApp struct { DotNetVersion string `tfschema:"dotnet_version"` // Supported values `v3.0`, `v4.0`, `v6.0`, `v7.0` and `v8.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` + JavaVersion string `tfschema:"java_version"` // Supported values `8`, `11`, `17`, `21` PowerShellCoreVersion string `tfschema:"powershell_core_version"` // Supported values are `7.0`, `7.2` CustomHandler bool `tfschema:"use_custom_runtime"` // Supported values `true` } @@ -1171,6 +1171,7 @@ func linuxFunctionAppStackSchema() *pluginsdk.Schema { "8", "11", "17", + "21", }, false), ExactlyOneOf: []string{ "site_config.0.application_stack.0.dotnet_version", @@ -1181,7 +1182,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 Java to use. Possible values are `8`, `11`, and `17`", + Description: "The version of Java to use. Possible values are `8`, `11`, `17`, and `21`", }, "docker": { @@ -1403,6 +1404,7 @@ func windowsFunctionAppStackSchema() *pluginsdk.Schema { "1.8", "11", "17", + "21", }, false), ExactlyOneOf: []string{ "site_config.0.application_stack.0.dotnet_version", @@ -1411,7 +1413,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 Java to use. Possible values are `1.8`, `11` and `17`", + Description: "The version of Java to use. Possible values are `1.8`, `11`, `17`, and `21`", }, "powershell_core_version": { diff --git a/internal/services/appservice/linux_web_app_resource_test.go b/internal/services/appservice/linux_web_app_resource_test.go index fdbc800730dbd..968050f439d36 100644 --- a/internal/services/appservice/linux_web_app_resource_test.go +++ b/internal/services/appservice/linux_web_app_resource_test.go @@ -1057,6 +1057,40 @@ func TestAccLinuxWebApp_withJre11Java(t *testing.T) { }) } + +func TestAccLinuxWebApp_withJre17Java(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_linux_web_app", "test") + r := LinuxWebAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.java(data, "17", "JAVA", "17"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("JAVA|17-java17"), + ), + }, + data.ImportStep("site_credential.0.password"), + }) +} + + +func TestAccLinuxWebApp_withJre21Java(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_linux_web_app", "test") + r := LinuxWebAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.java(data, "21", "JAVA", "21"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("JAVA|21-java21"), + ), + }, + data.ImportStep("site_credential.0.password"), + }) +} + func TestAccLinuxWebApp_withJava1109(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_linux_web_app", "test") r := LinuxWebAppResource{} diff --git a/internal/services/web/app_service_resource_test.go b/internal/services/web/app_service_resource_test.go index dd8f81b94a806..f37c60bf36e41 100644 --- a/internal/services/web/app_service_resource_test.go +++ b/internal/services/web/app_service_resource_test.go @@ -1294,6 +1294,43 @@ func TestAccAppService_windowsJava11Java(t *testing.T) { }) } + +func TestAccAppService_windowsJava17Java(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_app_service", "test") + r := AppServiceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.windowsJava(data, "17", "JAVA", "9.3"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("site_config.0.java_version").HasValue("11"), + check.That(data.ResourceName).Key("site_config.0.java_container").HasValue("JAVA"), + check.That(data.ResourceName).Key("site_config.0.java_container_version").HasValue("9.3"), + ), + }, + data.ImportStep(), + }) +} + +func TestAccAppService_windowsJava21Java(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_app_service", "test") + r := AppServiceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.windowsJava(data, "21", "JAVA", "9.3"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("site_config.0.java_version").HasValue("11"), + check.That(data.ResourceName).Key("site_config.0.java_container").HasValue("JAVA"), + check.That(data.ResourceName).Key("site_config.0.java_container_version").HasValue("9.3"), + ), + }, + data.ImportStep(), + }) +} + func TestAccAppService_windowsJava7Jetty(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_app_service", "test") r := AppServiceResource{} diff --git a/website/docs/r/function_app.html.markdown b/website/docs/r/function_app.html.markdown index 4fad99cea6024..7ae1eb601baf9 100644 --- a/website/docs/r/function_app.html.markdown +++ b/website/docs/r/function_app.html.markdown @@ -279,7 +279,7 @@ The `site_config` block supports the following: -> **NOTE** User has to explicitly set `ip_restriction` to empty slice (`[]`) to remove it. -* `java_version` - (Optional) Java version hosted by the function app in Azure. Possible values are `1.8`, `11` & `17` (In-Preview). +* `java_version` - (Optional) Java version hosted by the function app in Azure. Possible values are `1.8`, `11`, `17`, `21` (In-Preview). * `linux_fx_version` - (Optional) Linux App Framework and version for the AppService, e.g. `DOCKER|(golang:latest)`. diff --git a/website/docs/r/function_app_slot.html.markdown b/website/docs/r/function_app_slot.html.markdown index 39b679a016683..86000a838bb1d 100644 --- a/website/docs/r/function_app_slot.html.markdown +++ b/website/docs/r/function_app_slot.html.markdown @@ -132,7 +132,7 @@ The `site_config` block supports the following: * `linux_fx_version` - (Optional) Linux App Framework and version for the AppService, e.g. `DOCKER|(golang:latest)`. -* `java_version` - (Optional) Java version hosted by the function app in Azure. Possible values are `1.8`, `11` & `17` (In-Preview). +* `java_version` - (Optional) Java version hosted by the function app in Azure. Possible values are `1.8`, `11`, `17`, `21` (In-Preview). * `http2_enabled` - (Optional) Specifies whether or not the HTTP2 protocol should be enabled. Defaults to `false`. diff --git a/website/docs/r/linux_function_app.html.markdown b/website/docs/r/linux_function_app.html.markdown index 54749723f888f..472aef889f718 100644 --- a/website/docs/r/linux_function_app.html.markdown +++ b/website/docs/r/linux_function_app.html.markdown @@ -171,7 +171,7 @@ A `application_stack` block supports the following: * `use_dotnet_isolated_runtime` - (Optional) Should the DotNet process use an isolated runtime. Defaults to `false`. -* `java_version` - (Optional) The Version of Java to use. Supported versions include `8`, `11` & `17`. +* `java_version` - (Optional) The Version of Java to use. Supported versions include `8`, `11`, `17`, `21` (In-Preview). * `node_version` - (Optional) The version of Node to run. Possible values include `12`, `14`, `16`, `18` and `20`. diff --git a/website/docs/r/linux_function_app_slot.html.markdown b/website/docs/r/linux_function_app_slot.html.markdown index fadd640500ef7..9312ff499c06e 100644 --- a/website/docs/r/linux_function_app_slot.html.markdown +++ b/website/docs/r/linux_function_app_slot.html.markdown @@ -636,7 +636,7 @@ An `application_stack` block supports the following: * `use_dotnet_isolated_runtime` - (Optional) Should the DotNet process use an isolated runtime. Defaults to `false`. -* `java_version` - (Optional) The version of Java to use. Possible values are `8`, `11` & `17` (In-Preview). +* `java_version` - (Optional) The version of Java to use. Possible values are `8`, `11`, `17`, `21` (In-Preview). * `node_version` - (Optional) The version of Node to use. Possible values include `12`, `14`, `16`, `18` and `20` diff --git a/website/docs/r/linux_web_app.html.markdown b/website/docs/r/linux_web_app.html.markdown index 92c93ee5880af..a9427fd5025ab 100644 --- a/website/docs/r/linux_web_app.html.markdown +++ b/website/docs/r/linux_web_app.html.markdown @@ -166,7 +166,7 @@ An `application_stack` block supports the following: * `java_server_version` - (Optional) The Version of the `java_server` to use. -* `java_version` - (Optional) The Version of Java to use. Possible values include `8`, `11`, and `17`. +* `java_version` - (Optional) The Version of Java to use. Possible values include `8`, `11`, `17`, `21`. ~> **NOTE:** The valid version combinations for `java_version`, `java_server` and `java_server_version` can be checked from the command line via `az webapp list-runtimes --linux`. diff --git a/website/docs/r/linux_web_app_slot.html.markdown b/website/docs/r/linux_web_app_slot.html.markdown index 08f70150a5f52..fbadfa151d038 100644 --- a/website/docs/r/linux_web_app_slot.html.markdown +++ b/website/docs/r/linux_web_app_slot.html.markdown @@ -170,7 +170,7 @@ An `application_stack` block supports the following: * `java_server_version` - (Optional) The Version of the `java_server` to use. -* `java_version` - (Optional) The Version of Java to use. Possible values include `8`, `11`, and `17`. +* `java_version` - (Optional) The Version of Java to use. Possible values include `8`, `11`, `17`, `21`. ~> **NOTE:** The valid version combinations for `java_version`, `java_server` and `java_server_version` can be checked from the command line via `az webapp list-runtimes --linux`. diff --git a/website/docs/r/windows_function_app.html.markdown b/website/docs/r/windows_function_app.html.markdown index 052f52cd7b233..8682dfae5d62e 100644 --- a/website/docs/r/windows_function_app.html.markdown +++ b/website/docs/r/windows_function_app.html.markdown @@ -169,7 +169,7 @@ A `application_stack` block supports the following: * `use_dotnet_isolated_runtime` - (Optional) Should the DotNet process use an isolated runtime. Defaults to `false`. -* `java_version` - (Optional) The Version of Java to use. Supported versions include `1.8`, `11` & `17` (In-Preview). +* `java_version` - (Optional) The Version of Java to use. Supported versions include `1.8`, `11`, `17`, `21` (In-Preview). * `node_version` - (Optional) The version of Node to run. Possible values include `~12`, `~14`, `~16`, `~18` and `~20`. diff --git a/website/docs/r/windows_function_app_slot.html.markdown b/website/docs/r/windows_function_app_slot.html.markdown index 496322e7ca8fb..c49301bab06c5 100644 --- a/website/docs/r/windows_function_app_slot.html.markdown +++ b/website/docs/r/windows_function_app_slot.html.markdown @@ -629,7 +629,7 @@ An `application_stack` block supports the following: * `use_dotnet_isolated_runtime` - (Optional) Should the DotNet process use an isolated runtime. Defaults to `false`. -* `java_version` - (Optional) The version of Java to use. Possible values are `1.8`, `11` and `17` (In-Preview). +* `java_version` - (Optional) The version of Java to use. Possible values are `1.8`, `11` `17`, `21` (In-Preview). * `node_version` - (Optional) The version of Node to use. Possible values are `~12`, `~14`, `~16`, `~18` and `~20`. diff --git a/website/docs/r/windows_web_app_slot.html.markdown b/website/docs/r/windows_web_app_slot.html.markdown index 938319acba280..547c7ff663539 100644 --- a/website/docs/r/windows_web_app_slot.html.markdown +++ b/website/docs/r/windows_web_app_slot.html.markdown @@ -180,7 +180,7 @@ An `application_stack` block supports the following: * `java_embedded_server_enabled` - (Optional) Should the Java Embedded Server (Java SE) be used to run the app. -* `java_version` - (Optional) The version of Java to use when `current_stack` is set to `java`. Possible values include `1.7`, `1.8`, `11` and `17`. Required with `java_container` and `java_container_version`. +* `java_version` - (Optional) The version of Java to use when `current_stack` is set to `java`. Possible values include `1.7`, `1.8`, `11`, `17`, `21`. Required with `java_container` and `java_container_version`. ~> **NOTE:** For compatible combinations of `java_version`, `java_container` and `java_container_version` users can use `az webapp list-runtimes` from command line.