Skip to content

Commit

Permalink
Disable autoscale when app svc plan module configured for az func (#367)
Browse files Browse the repository at this point in the history
* add count conditional on the basis of whether or not service plan tier is 'dynamic' aka auto-scalling azure function'

* Update unit tests to expected a list of autoscale resources

* Lint changes

Lint changes to terraform file as well

Co-authored-by: Dexter Williams <Dexterw@microsoft.com>
  • Loading branch information
TechnicallyWilliams and TechnicallyWilliams authored Apr 24, 2020
1 parent 9accc7f commit 8c4bd22
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions infra/modules/providers/azure/service-plan/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ resource "azurerm_monitor_autoscale_setting" "app_service_auto_scale" {
resource_group_name = var.resource_group_name
location = data.azurerm_resource_group.svcplan.location
target_resource_id = azurerm_app_service_plan.svcplan.id
# Dynamic is the basic plan tier for Azure Function that does not allow custom autoscaling
count = var.service_plan_tier == "Dynamic" ? 0 : 1

profile {
name = "Scaling Profile"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func TestTemplate(t *testing.T) {
"module.authn_app_service.azurerm_app_service.appsvc[0]": expectedAppService,
"module.app_service.azurerm_app_service_slot.appsvc_staging_slot[0]": expectedAppServiceSlot,
"module.authn_app_service.azurerm_app_service_slot.appsvc_staging_slot[0]": expectedAppServiceSlot,
"module.service_plan.azurerm_monitor_autoscale_setting.app_service_auto_scale": expectedAutoScalePlan,
"module.service_plan.azurerm_monitor_autoscale_setting.app_service_auto_scale[0]": expectedAutoScalePlan,
"module.app_service_keyvault_access_policy.azurerm_key_vault_access_policy.keyvault[0]": expectedAppServiceKVPolicies,
"module.authn_app_service_keyvault_access_policy.azurerm_key_vault_access_policy.keyvault[0]": expectedAppServiceKVPolicies,
"module.keyvault.module.deployment_service_principal_keyvault_access_policies.azurerm_key_vault_access_policy.keyvault[0]": expectedDeploymentServicePrincipalKVPolicies,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func TestTemplate(t *testing.T) {
},
"module.app_service.azurerm_app_service.appsvc[0]": expectedAppServicePlan,
"module.app_gateway.azurerm_application_gateway.appgateway": expectedAppGatewayPlan,
"module.service_plan.azurerm_monitor_autoscale_setting.app_service_auto_scale": expectedAutoScalePlan,
"module.service_plan.azurerm_monitor_autoscale_setting.app_service_auto_scale[0]": expectedAutoScalePlan,
"module.keyvault.module.deployment_service_principal_keyvault_access_policies.azurerm_key_vault_access_policy.keyvault[0]": expectedDeploymentServicePrincipalKVPolicies,
},
}
Expand Down

0 comments on commit 8c4bd22

Please sign in to comment.