Skip to content

Commit

Permalink
Allow java_version 21 for app services and functions. fixes #25490, #…
Browse files Browse the repository at this point in the history
…24754

Signed-off-by: Marvin B. Lillehaug <marvin.lillehaug@nte.no>
  • Loading branch information
computerlove committed Jun 13, 2024
1 parent b8e0968 commit 6cfa482
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ ENHANCEMENTS:
* `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_lb_backend_address_pool` - support for the `synchronous_mode` property [GH-26309]
* `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. ([#24754](https://github.com/hashicorp/terraform-provider-azurerm/issues/24754))
* `azurerm_windows_function_app` - Support Java 21. ([#24754](https://github.com/hashicorp/terraform-provider-azurerm/issues/24754))

BUG FIXES:

Expand Down
1 change: 1 addition & 0 deletions internal/services/appservice/helpers/app_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ func linuxApplicationStackSchema() *pluginsdk.Schema {
"8",
"11",
"17",
"21",
}, false),
ExactlyOneOf: linuxApplicationStackConstraint,
RequiredWith: []string{
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 @@ -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
}
Expand All @@ -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`
}
Expand Down Expand Up @@ -1171,6 +1171,7 @@ func linuxFunctionAppStackSchema() *pluginsdk.Schema {
"8",
"11",
"17",
"21",
}, false),
ExactlyOneOf: []string{
"site_config.0.application_stack.0.dotnet_version",
Expand All @@ -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": {
Expand Down Expand Up @@ -1403,6 +1404,7 @@ func windowsFunctionAppStackSchema() *pluginsdk.Schema {
"1.8",
"11",
"17",
"21",
}, false),
ExactlyOneOf: []string{
"site_config.0.application_stack.0.dotnet_version",
Expand All @@ -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": {
Expand Down
32 changes: 32 additions & 0 deletions internal/services/appservice/linux_web_app_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,38 @@ func TestAccLinuxWebApp_withJava8JBOSSEAP73(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"),
})
}

// TODO - finish known Java matrix combination tests...?

func TestAccLinuxWebApp_withDocker(t *testing.T) {
Expand Down
32 changes: 32 additions & 0 deletions internal/services/appservice/windows_function_app_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,38 @@ func TestAccWindowsFunctionApp_appStackJava11(t *testing.T) {
})
}

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

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.appStackJava(data, SkuBasicPlan, "17"),
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_appStackJava21(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_windows_function_app", "test")
r := WindowsFunctionAppResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.appStackJava(data, SkuBasicPlan, "21"),
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_appStackJavaUpdate(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_windows_function_app", "test")
r := WindowsFunctionAppResource{}
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 @@ -961,6 +961,21 @@ func TestAccWindowsWebApp_withJava17Embedded(t *testing.T) {
})
}

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

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

func TestAccWindowsWebApp_withJava1702Embedded(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_windows_web_app", "test")
r := WindowsWebAppResource{}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/function_app.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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)`.

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 @@ -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`.

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 @@ -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`, and `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`.

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 @@ -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`.

Expand Down

0 comments on commit 6cfa482

Please sign in to comment.