From 034fb2f3a58b97337748b3d9628fe2f572ca70a8 Mon Sep 17 00:00:00 2001 From: Philipp Resch Date: Wed, 17 Apr 2019 12:02:16 +0200 Subject: [PATCH] Added Java 11 to App Service resource --- azurerm/helpers/azure/app_service.go | 1 + azurerm/resource_arm_app_service_slot_test.go | 46 ++++++++++++++++ azurerm/resource_arm_app_service_test.go | 54 +++++++++++++++++++ website/docs/r/app_service.html.markdown | 2 +- website/docs/r/app_service_slot.html.markdown | 2 +- 5 files changed, 103 insertions(+), 2 deletions(-) diff --git a/azurerm/helpers/azure/app_service.go b/azurerm/helpers/azure/app_service.go index c1474ea4f1ca..4a5224d750d3 100644 --- a/azurerm/helpers/azure/app_service.go +++ b/azurerm/helpers/azure/app_service.go @@ -79,6 +79,7 @@ func SchemaAppServiceSiteConfig() *schema.Schema { ValidateFunc: validation.StringInSlice([]string{ "1.7", "1.8", + "11", }, false), }, diff --git a/azurerm/resource_arm_app_service_slot_test.go b/azurerm/resource_arm_app_service_slot_test.go index 4bb9df69b550..3642f2706cf6 100644 --- a/azurerm/resource_arm_app_service_slot_test.go +++ b/azurerm/resource_arm_app_service_slot_test.go @@ -716,6 +716,29 @@ func TestAccAzureRMAppServiceSlot_windowsJava8Jetty(t *testing.T) { }, }) } +func TestAccAzureRMAppServiceSlot_windowsJava11Jetty(t *testing.T) { + resourceName := "azurerm_app_service_slot.test" + ri := tf.AccRandTimeInt() + config := testAccAzureRMAppServiceSlot_windowsJava(ri, testLocation(), "11", "JETTY", "9.3") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMAppServiceSlotDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMAppServiceSlotExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "site_config.0.java_version", "11"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container", "JETTY"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container_version", "9.3"), + ), + }, + }, + }) +} + func TestAccAzureRMAppServiceSlot_windowsJava7Tomcat(t *testing.T) { resourceName := "azurerm_app_service_slot.test" ri := tf.AccRandTimeInt() @@ -762,6 +785,29 @@ func TestAccAzureRMAppServiceSlot_windowsJava8Tomcat(t *testing.T) { }) } +func TestAccAzureRMAppServiceSlot_windowsJava11Tomcat(t *testing.T) { + resourceName := "azurerm_app_service_slot.test" + ri := tf.AccRandTimeInt() + config := testAccAzureRMAppServiceSlot_windowsJava(ri, testLocation(), "11", "TOMCAT", "9.0") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMAppServiceSlotDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMAppServiceSlotExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "site_config.0.java_version", "11"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container", "TOMCAT"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container_version", "9.0"), + ), + }, + }, + }) +} + func TestAccAzureRMAppServiceSlot_windowsPHP7(t *testing.T) { resourceName := "azurerm_app_service_slot.test" ri := tf.AccRandTimeInt() diff --git a/azurerm/resource_arm_app_service_test.go b/azurerm/resource_arm_app_service_test.go index 993bd3b66c70..ce5c4fe01ea8 100644 --- a/azurerm/resource_arm_app_service_test.go +++ b/azurerm/resource_arm_app_service_test.go @@ -959,6 +959,33 @@ func TestAccAzureRMAppService_windowsJava8Jetty(t *testing.T) { }, }) } +func TestAccAzureRMAppService_windowsJava11Jetty(t *testing.T) { + resourceName := "azurerm_app_service.test" + ri := tf.AccRandTimeInt() + config := testAccAzureRMAppService_windowsJava(ri, testLocation(), "11", "JETTY", "9.3") + + 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"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container", "JETTY"), + resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container_version", "9.3"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} func TestAccAzureRMAppService_windowsJava7Tomcat(t *testing.T) { resourceName := "azurerm_app_service.test" ri := tf.AccRandTimeInt() @@ -1014,6 +1041,33 @@ func TestAccAzureRMAppService_windowsJava8Tomcat(t *testing.T) { }, }) } +func TestAccAzureRMAppService_windowsJava11Tomcat(t *testing.T) { + resourceName := "azurerm_app_service.test" + ri := tf.AccRandTimeInt() + config := testAccAzureRMAppService_windowsJava(ri, testLocation(), "11", "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", "11"), + 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" diff --git a/website/docs/r/app_service.html.markdown b/website/docs/r/app_service.html.markdown index 507008caa420..44bec32079d5 100644 --- a/website/docs/r/app_service.html.markdown +++ b/website/docs/r/app_service.html.markdown @@ -125,7 +125,7 @@ A `site_config` block supports the following: * `ip_restriction` - (Optional) One or more `ip_restriction` blocks 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` and `1.8`. +* `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_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`. diff --git a/website/docs/r/app_service_slot.html.markdown b/website/docs/r/app_service_slot.html.markdown index 88ddd1e171d0..5c0883d8c717 100644 --- a/website/docs/r/app_service_slot.html.markdown +++ b/website/docs/r/app_service_slot.html.markdown @@ -200,7 +200,7 @@ The following arguments are supported: * `java_container_version` - (Optional) The version of the Java Container to use. If specified `java_version` and `java_container` must also be specified. -* `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` and `1.8`. +* `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`. * `local_mysql_enabled` - (Optional) Is "MySQL In App" Enabled? This runs a local MySQL instance with your app and shares resources from the App Service plan.