From c08ccf11f8d430a25f1e6b01ab1c7a79ed2f0fe7 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Fri, 4 May 2018 13:30:36 +0100 Subject: [PATCH] Adding `http2_enabled` to App Service Slot. Fixes a Set error --- azurerm/resource_arm_app_service_slot.go | 6 ++ azurerm/resource_arm_app_service_slot_test.go | 60 +++++++++++++++++++ website/docs/r/app_service_slot.html.markdown | 2 +- 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/azurerm/resource_arm_app_service_slot.go b/azurerm/resource_arm_app_service_slot.go index 0b6f8cbe2529..c4dc6f6d9101 100644 --- a/azurerm/resource_arm_app_service_slot.go +++ b/azurerm/resource_arm_app_service_slot.go @@ -75,6 +75,12 @@ func resourceArmAppServiceSlot() *schema.Resource { DiffSuppressFunc: ignoreCaseDiffSuppressFunc, }, + "http2_enabled": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "java_version": { Type: schema.TypeString, Optional: true, diff --git a/azurerm/resource_arm_app_service_slot_test.go b/azurerm/resource_arm_app_service_slot_test.go index ed84d8526382..2f427dbc5f63 100644 --- a/azurerm/resource_arm_app_service_slot_test.go +++ b/azurerm/resource_arm_app_service_slot_test.go @@ -202,6 +202,27 @@ func TestAccAzureRMAppServiceSlot_httpsOnly(t *testing.T) { }) } +func TestAccAzureRMAppServiceSlot_http2Enabled(t *testing.T) { + resourceName := "azurerm_app_service_slot.test" + ri := acctest.RandInt() + config := testAccAzureRMAppServiceSlot_http2Enabled(ri, testLocation()) + + resource.Test(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.http2_enabled", "true"), + ), + }, + }, + }) +} + func TestAccAzureRMAppServiceSlot_localMySql(t *testing.T) { resourceName := "azurerm_app_service_slot.test" ri := acctest.RandInt() @@ -924,6 +945,45 @@ resource "azurerm_app_service_slot" "test" { `, rInt, location, rInt, rInt, rInt) } +func testAccAzureRMAppServiceSlot_http2Enabled(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_app_service_plan" "test" { + name = "acctestASP-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + tier = "Standard" + size = "S1" + } +} + +resource "azurerm_app_service" "test" { + name = "acctestAS-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + app_service_plan_id = "${azurerm_app_service_plan.test.id}" +} + +resource "azurerm_app_service_slot" "test" { + name = "acctestASSlot-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + app_service_plan_id = "${azurerm_app_service_plan.test.id}" + app_service_name = "${azurerm_app_service.test.name}" + + site_config { + http2_enabled = true + } +} +`, rInt, location, rInt, rInt, rInt) +} + func testAccAzureRMAppServiceSlot_localMySql(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { diff --git a/website/docs/r/app_service_slot.html.markdown b/website/docs/r/app_service_slot.html.markdown index 85913967465d..f53326f69871 100644 --- a/website/docs/r/app_service_slot.html.markdown +++ b/website/docs/r/app_service_slot.html.markdown @@ -183,7 +183,7 @@ The following arguments are supported: * `always_on` - (Optional) Should the app be loaded at all times? Defaults to `false`. * `default_documents` - (Optional) The ordering of default documents to load, if an address isn't specified. * `dotnet_framework_version` - (Optional) The version of the .net framework's CLR used in this App Service Slot. Possible values are `v2.0` (which will use the latest version of the .net framework for the .net CLR v2 - currently `.net 3.5`) and `v4.0` (which corresponds to the latest version of the .net CLR v4 - which at the time of writing is `.net 4.7.1`). [For more information on which .net CLR version to use based on the .net framework you're targetting - please see this table](https://en.wikipedia.org/wiki/.NET_Framework_version_history#Overview). Defaults to `v4.0`. - +* `http2_enabled` - (Optional) Is HTTP2 Enabled on this App Service? Defaults to `false`. * `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_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_version` - (Optional) The version of the Java Container to use. If specified `java_version` and `java_container` must also be specified.