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

add support for elastic App plan aka Azure Function Premium Consumption #3402

Merged
merged 2 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions azurerm/resource_arm_app_service_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func resourceArmAppServicePlan() *schema.Resource {
// @tombuildsstuff: I believe `app` is the older representation of `Windows`
// thus we need to support it to be able to import resources without recreating them.
"App",
"elastic",
"FunctionApp",
"Linux",
"Windows",
Expand Down
42 changes: 42 additions & 0 deletions azurerm/resource_arm_app_service_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,27 @@ func TestAccAzureRMAppServicePlan_consumptionPlan(t *testing.T) {
})
}

func TestAccAzureRMAppServicePlan_premiumConsumptionPlan(t *testing.T) {
resourceName := "azurerm_app_service_plan.test"
ri := tf.AccRandTimeInt()

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMAppServicePlanDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMAppServicePlan_premiumConsumptionPlan(ri, testLocation()),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServicePlanExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "sku.0.tier", "ElasticPremium"),
resource.TestCheckResourceAttr(resourceName, "sku.0.size", "EP1"),
),
},
},
})
}

func testCheckAzureRMAppServicePlanDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*ArmClient).appServicePlansClient

Expand Down Expand Up @@ -559,3 +580,24 @@ resource "azurerm_app_service_plan" "test" {
}
`, rInt, location, rInt)
}

func testAccAzureRMAppServicePlan_premiumConsumptionPlan(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"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
kind = "elastic"

sku {
tier = "ElasticPremium"
size = "EP1"
}
}
`, rInt, location, rInt)
}
2 changes: 1 addition & 1 deletion website/docs/r/app_service_plan.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ The following arguments are supported:

* `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

* `kind` - (Optional) The kind of the App Service Plan to create. Possible values are `Windows` (also available as `App`), `Linux` and `FunctionApp` (for a Consumption Plan). Defaults to `Windows`. Changing this forces a new resource to be created.
* `kind` - (Optional) The kind of the App Service Plan to create. Possible values are `Windows` (also available as `App`), `Linux`, `elastic` (for Premium Consumption) and `FunctionApp` (for a Consumption Plan). Defaults to `Windows`. Changing this forces a new resource to be created.

~> **NOTE:** When creating a `Linux` App Service Plan, the `reserved` field must be set to `true`.

Expand Down