Skip to content

azurermAppServicePlan

Manages an App Service Plan component.

!> NOTE: This resource has been deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0. Please use azurermServicePlan resource instead.

Example Usage (Dedicated)

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "api-rg-pro",
  }
);
const azurermAppServicePlanExample = new azurerm.appServicePlan.AppServicePlan(
  this,
  "example_1",
  {
    location: azurermResourceGroupExample.location,
    name: "api-appserviceplan-pro",
    resource_group_name: azurermResourceGroupExample.name,
    sku: [
      {
        size: "S1",
        tier: "Standard",
      },
    ],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermAppServicePlanExample.overrideLogicalId("example");

Example Usage (Shared / Consumption Plan)

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "api-rg-pro",
  }
);
const azurermAppServicePlanExample = new azurerm.appServicePlan.AppServicePlan(
  this,
  "example_1",
  {
    kind: "FunctionApp",
    location: azurermResourceGroupExample.location,
    name: "api-appserviceplan-pro",
    resource_group_name: azurermResourceGroupExample.name,
    sku: [
      {
        size: "Y1",
        tier: "Dynamic",
      },
    ],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermAppServicePlanExample.overrideLogicalId("example");

Example Usage (Linux)

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "api-rg-pro",
  }
);
const azurermAppServicePlanExample = new azurerm.appServicePlan.AppServicePlan(
  this,
  "example_1",
  {
    kind: "Linux",
    location: azurermResourceGroupExample.location,
    name: "api-appserviceplan-pro",
    reserved: true,
    resource_group_name: azurermResourceGroupExample.name,
    sku: [
      {
        size: "S1",
        tier: "Standard",
      },
    ],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermAppServicePlanExample.overrideLogicalId("example");

Example Usage (Windows Container)

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "api-rg-pro",
  }
);
const azurermAppServicePlanExample = new azurerm.appServicePlan.AppServicePlan(
  this,
  "example_1",
  {
    is_xenon: true,
    kind: "xenon",
    location: azurermResourceGroupExample.location,
    name: "api-appserviceplan-pro",
    resource_group_name: azurermResourceGroupExample.name,
    sku: [
      {
        size: "PC2",
        tier: "PremiumContainer",
      },
    ],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermAppServicePlanExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the App Service Plan component. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which to create the App Service Plan component. Changing this forces a new resource to be created.

  • 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, elastic (for Premium Consumption), xenon 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, and when creating a windows/app App Service Plan the reserved field must be set to false.

  • maximumElasticWorkerCount - (Optional) The maximum number of total workers allowed for this ElasticScaleEnabled App Service Plan.

  • sku - (Required) A sku block as documented below.

  • appServiceEnvironmentId - (Optional) The ID of the App Service Environment where the App Service Plan should be located. Changing forces a new resource to be created.

\~> NOTE: Attaching to an App Service Environment requires the App Service Plan use a premium SKU (when using an ASEv1) and the isolated SKU (for an ASEv2).

  • reserved - (Optional) Is this App Service Plan reserved.

  • perSiteScaling - (Optional) Can Apps assigned to this App Service Plan be scaled independently? If set to false apps assigned to this plan will scale to all instances of the plan.

  • isXenon - (Optional) Whether to create a xenon App Service Plan.

  • zoneRedundant - (Optional) Specifies if the App Service Plan should be Zone Redundant. Changing this forces a new resource to be created.

\~> NOTE: Requires either premiumV2 or premiumV3 SKU and that at least 3 instances. For more information, please see the App Service Team Blog.

  • tags - (Optional) A mapping of tags to assign to the resource.

The sku block supports the following:

  • tier - (Required) Specifies the plan's pricing tier.

  • size - (Required) Specifies the plan's instance size.

  • capacity - (Optional) Specifies the number of workers associated with this App Service Plan.

Attributes Reference

The following attributes are exported:

  • id - The ID of the App Service Plan component.
  • maximumNumberOfWorkers - The maximum number of workers supported with the App Service Plan's sku.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 60 minutes) Used when creating the App Service Plan.
  • update - (Defaults to 60 minutes) Used when updating the App Service Plan.
  • read - (Defaults to 5 minutes) Used when retrieving the App Service Plan.
  • delete - (Defaults to 60 minutes) Used when deleting the App Service Plan.

Import

App Service Plan instances can be imported using the resourceId, e.g.

terraform import azurerm_app_service_plan.instance1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Web/serverfarms/instance1