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

azurerm_function_app - make pre_warmed_instance_count computed to use azure's default #9069

Merged
merged 7 commits into from
Dec 29, 2020
Merged
1 change: 1 addition & 0 deletions azurerm/internal/services/web/function_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func schemaAppServiceFunctionAppSiteConfig() *schema.Schema {
"pre_warmed_instance_count": {
Type: schema.TypeInt,
Optional: true,
Default: 1,
ValidateFunc: validation.IntBetween(0, 10),
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,26 @@ func TestAccAzureRMFunctionApp_preWarmedInstanceCount(t *testing.T) {
})
}

func TestAccAzureRMFunctionApp_defaultPreWarmedInstanceCount(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_function_app", "test")

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acceptance.PreCheck(t) },
Providers: acceptance.SupportedProviders,
CheckDestroy: testCheckAzureRMFunctionAppDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMFunctionApp_defaultPreWarmedInstanceCount(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMFunctionAppExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.pre_warmed_instance_count", "1"),
),
},
data.ImportStep(),
},
})
}

func TestAccAzureRMFunctionApp_oneIpRestriction(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_function_app", "test")

Expand Down Expand Up @@ -2421,6 +2441,47 @@ resource "azurerm_function_app" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomInteger, data.RandomInteger)
}

func testAccAzureRMFunctionApp_defaultPreWarmedInstanceCount(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}

resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}

resource "azurerm_storage_account" "test" {
name = "acctestsa%s"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
account_tier = "Standard"
account_replication_type = "LRS"
}

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"
}
}

resource "azurerm_function_app" "test" {
name = "acctest-%d-func"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
app_service_plan_id = azurerm_app_service_plan.test.id
storage_connection_string = azurerm_storage_account.test.primary_connection_string
}
`, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomInteger, data.RandomInteger)
}

func testAccAzureRMFunctionApp_oneIpRestriction(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
Expand Down