Skip to content

azurermAppServiceEnvironment

Manages an App Service Environment.

Example Usage

/*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: "exampleRG1",
  }
);
const azurermVirtualNetworkExample = new azurerm.virtualNetwork.VirtualNetwork(
  this,
  "example_1",
  {
    address_space: ["10.0.0.0/16"],
    location: azurermResourceGroupExample.location,
    name: "example-vnet1",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualNetworkExample.overrideLogicalId("example");
const azurermSubnetAse = new azurerm.subnet.Subnet(this, "ase", {
  address_prefixes: ["10.0.1.0/24"],
  name: "asesubnet",
  resource_group_name: azurermResourceGroupExample.name,
  virtual_network_name: azurermVirtualNetworkExample.name,
});
new azurerm.subnet.Subnet(this, "gateway", {
  address_prefixes: ["10.0.2.0/24"],
  name: "gatewaysubnet",
  resource_group_name: azurermResourceGroupExample.name,
  virtual_network_name: azurermVirtualNetworkExample.name,
});
const azurermAppServiceEnvironmentExample =
  new azurerm.appServiceEnvironment.AppServiceEnvironment(this, "example_4", {
    allowed_user_ip_cidrs: ["11.22.33.44/32", "55.66.77.0/24"],
    cluster_setting: [
      {
        name: "DisableTls1.0",
        value: "1",
      },
    ],
    front_end_scale_factor: 10,
    internal_load_balancing_mode: "Web, Publishing",
    name: "example-ase",
    pricing_tier: "I2",
    resource_group_name: azurermResourceGroupExample.name,
    subnet_id: azurermSubnetAse.id,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermAppServiceEnvironmentExample.overrideLogicalId("example");

Argument Reference

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

  • subnetId - (Required) The ID of the Subnet which the App Service Environment should be connected to. Changing this forces a new resource to be created.

\~> NOTE a /24 or larger CIDR is required. Once associated with an ASE this size cannot be changed.

  • clusterSetting - (Optional) Zero or more clusterSetting blocks as defined below.

  • internalLoadBalancingMode - (Optional) Specifies which endpoints to serve internally in the Virtual Network for the App Service Environment. Possible values are none, web, publishing and combined value "web,Publishing". Defaults to none. Changing this forces a new resource to be created.

  • pricingTier - (Optional) Pricing tier for the front end instances. Possible values are i1, i2 and i3. Defaults to i1.

  • frontEndScaleFactor - (Optional) Scale factor for front end instances. Possible values are between 5 and 15. Defaults to 15.

  • allowedUserIpCidrs - (Optional) Allowed user added IP ranges on the ASE database. Use the addresses you want to set as the explicit egress address ranges.

\~> NOTE: allowedUserIpCidrs The addresses that will be used for all outbound traffic from your App Service Environment to the internet to avoid asymmetric routing challenge. If you're routing the traffic on premises, these addresses are your NATs or gateway IPs. If you want to route the App Service Environment outbound traffic through an NVA, the egress address is the public IP of the NVA. Please visit Create your ASE with the egress addresses

  • resourceGroupName - (Required) The name of the Resource Group where the App Service Environment exists. Defaults to the Resource Group of the Subnet (specified by subnetId).

  • tags - (Optional) A mapping of tags to assign to the resource. Changing this forces a new resource to be created.


A clusterSetting block supports the following:

  • name - (Required) The name of the Cluster Setting.

  • value - (Required) The value for the Cluster Setting.

Attributes Reference

  • id - The ID of the App Service Environment.

  • internalIpAddress - IP address of internal load balancer of the App Service Environment.

  • location - The location where the App Service Environment exists.

  • outboundIpAddresses - List of outbound IP addresses of the App Service Environment.

  • serviceIpAddress - IP address of service endpoint of the App Service Environment.

Timeouts

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

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

Import

The App Service Environment can be imported using the resourceId, e.g.

terraform import azurerm_app_service_environment.myAppServiceEnv /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Web/hostingEnvironments/myAppServiceEnv