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

support minor version of java in azurerm_app_service settings #4779

Merged
merged 4 commits into from
Nov 17, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 4 additions & 5 deletions azurerm/helpers/azure/app_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"log"
"net"
"regexp"
"strings"

"github.com/Azure/azure-sdk-for-go/services/web/mgmt/2018-02-01/web"
Expand Down Expand Up @@ -328,11 +329,9 @@ func SchemaAppServiceSiteConfig() *schema.Schema {
"java_version": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
"1.7",
"1.8",
"11",
}, false),
ValidateFunc: validation.StringMatch(
regexp.MustCompile(`^(1\.7|1\.8|11)`),
`Invalid Java version provided`),
aczelandi marked this conversation as resolved.
Show resolved Hide resolved
},

"java_container": {
Expand Down
84 changes: 84 additions & 0 deletions azurerm/resource_arm_app_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,90 @@ func TestAccAzureRMAppService_windowsJava11Tomcat(t *testing.T) {
})
}

func TestAccAzureRMAppService_windowsJava7Minor(t *testing.T) {
resourceName := "azurerm_app_service.test"
ri := tf.AccRandTimeInt()
config := testAccAzureRMAppService_windowsJava(ri, testLocation(), "1.7.0_80", "TOMCAT", "9.0")

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMAppServiceDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_version", "1.7.0_80"),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container", "TOMCAT"),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container_version", "9.0"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAzureRMAppService_windowsJava8Minor(t *testing.T) {
resourceName := "azurerm_app_service.test"
ri := tf.AccRandTimeInt()
config := testAccAzureRMAppService_windowsJava(ri, testLocation(), "1.8.0_181", "TOMCAT", "9.0")

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMAppServiceDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_version", "1.8.0_181"),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container", "TOMCAT"),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container_version", "9.0"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAzureRMAppService_windowsJava11Minor(t *testing.T) {
aczelandi marked this conversation as resolved.
Show resolved Hide resolved
resourceName := "azurerm_app_service.test"
ri := tf.AccRandTimeInt()
config := testAccAzureRMAppService_windowsJava(ri, testLocation(), "11.0.1", "TOMCAT", "9.0")
aczelandi marked this conversation as resolved.
Show resolved Hide resolved

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMAppServiceDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_version", "11.0.1"),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container", "TOMCAT"),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container_version", "9.0"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAzureRMAppService_windowsPHP7(t *testing.T) {
resourceName := "azurerm_app_service.test"
ri := tf.AccRandTimeInt()
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/app_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ A `site_config` block supports the following:

* `ip_restriction` - (Optional) A [List of objects](/docs/configuration/attr-as-blocks.html) representing ip restrictions as defined below.

* `java_version` - (Optional) The version of Java to use. If specified `java_container` and `java_container_version` must also be specified. Possible values are `1.7`, `1.8` and `11`.
* `java_version` - (Optional) The version of Java to use. If specified `java_container` and `java_container_version` must also be specified. Possible values are `1.7`, `1.8` and `11` and their minor/patch versions.
aczelandi marked this conversation as resolved.
Show resolved Hide resolved

* `java_container` - (Optional) The Java Container to use. If specified `java_version` and `java_container_version` must also be specified. Possible values are `JETTY` and `TOMCAT`.

Expand Down