Skip to content

Commit

Permalink
azurerm_app_service - Add support for JAVA container (#4897)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpduck authored and mbfrahry committed Nov 15, 2019
1 parent c1a7273 commit 1e86dd1
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 1 deletion.
1 change: 1 addition & 0 deletions azurerm/helpers/azure/app_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ func SchemaAppServiceSiteConfig() *schema.Schema {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
"JAVA",
"JETTY",
"TOMCAT",
}, true),
Expand Down
83 changes: 83 additions & 0 deletions azurerm/resource_arm_app_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,89 @@ func TestAccAzureRMAppService_windowsDotNetUpdate(t *testing.T) {
})
}

func TestAccAzureRMAppService_windowsJava7Java(t *testing.T) {
resourceName := "azurerm_app_service.test"
ri := tf.AccRandTimeInt()
config := testAccAzureRMAppService_windowsJava(ri, testLocation(), "1.7", "JAVA", "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", "1.7"),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container", "JAVA"),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container_version", "9.3"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAzureRMAppService_windowsJava8Java(t *testing.T) {
resourceName := "azurerm_app_service.test"
ri := tf.AccRandTimeInt()
config := testAccAzureRMAppService_windowsJava(ri, testLocation(), "1.8", "JAVA", "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", "1.8"),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container", "JAVA"),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container_version", "9.3"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
func TestAccAzureRMAppService_windowsJava11Java(t *testing.T) {
resourceName := "azurerm_app_service.test"
ri := tf.AccRandTimeInt()
config := testAccAzureRMAppService_windowsJava(ri, testLocation(), "11", "JAVA", "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", "JAVA"),
resource.TestCheckResourceAttr(resourceName, "site_config.0.java_container_version", "9.3"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAzureRMAppService_windowsJava7Jetty(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 @@ -192,7 +192,7 @@ A `site_config` block supports the following:

* `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`.
* `java_container` - (Optional) The Java Container to use. If specified `java_version` and `java_container_version` must also be specified. Possible values are `JAVA`, `JETTY`, and `TOMCAT`.

* `java_container_version` - (Optional) The version of the Java Container to use. If specified `java_version` and `java_container` must also be specified.

Expand Down

0 comments on commit 1e86dd1

Please sign in to comment.