Azure App Service (Web Apps) Environment
This page shows how to write Terraform for App Service (Web Apps) Environment and write them securely.
azurerm_app_service_environment (Terraform)
The Environment in App Service (Web Apps) can be configured in Terraform with the resource name azurerm_app_service_environment
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_app_service_environment" "example_I1" {
name = "example-ase"
subnet_id = azurerm_subnet.ase.id
pricing_tier = "I1"
front_end_scale_factor = 10
internal_load_balancing_mode = "Web, Publishing"
resource "azurerm_app_service_environment" "example_I1" {
name = "example-ase"
subnet_id = azurerm_subnet.ase.id
pricing_tier = "I1"
front_end_scale_factor = 10
internal_load_balancing_mode = "Web, Publishing"
resource "azurerm_app_service_environment" "example" {
name = "example-ase"
subnet_id = azurerm_subnet.ase.id
pricing_tier = "I2"
front_end_scale_factor = 10
internal_load_balancing_mode = "Web, Publishing"
resource "azurerm_app_service_environment" "ase" {
name = var.res_ase_name
subnet_id = var.res_ase_subnet_id
pricing_tier = var.res_ase_pricing_tier
front_end_scale_factor = var.res_ase_fe_scale
resource_group_name = var.res_rg_name
resource "azurerm_app_service_environment" "ase" {
name = "example-ase"
subnet_id = var.aseSubnetId
internal_load_balancing_mode = "Web, Publishing"
cluster_setting {
resource "azurerm_app_service_environment" "app_service_environment" {
name = var.app_service_environment_name
resource_group_name = var.resource_group_name
subnet_id = var.subnet_id
pricing_tier = var.ase_pricing_tier
front_end_scale_factor = var.front_end_scale_factor
resource "azurerm_app_service_environment" "app_service_environment" {
name = var.app_service_environment_name
resource_group_name = var.resource_group_name
subnet_id = var.subnet_id
pricing_tier = var.ase_pricing_tier
front_end_scale_factor = var.front_end_scale_factor
resource "azurerm_app_service_environment" "example" {
name = var.name
subnet_id = module.subnet.azurerm_subnet.example.id
pricing_tier = var.pricing_tier
front_end_scale_factor = var.front_end_scale
internal_load_balancing_mode = var.internal_load_balance
resource "azurerm_app_service_environment" "this" {
front_end_scale_factor = var.front_end_scale_factor
internal_load_balancing_mode = var.internal_load_balancing_mode
name = var.name
pricing_tier = var.pricing_tier
subnet_id = var.subnet_id
resource "azurerm_app_service_environment" "function" {
name = "consul-function-env"
subnet_id = azurerm_subnet.consul.id
pricing_tier = "I1"
front_end_scale_factor = 5
internal_load_balancing_mode = "None"
Parameters
-
allowed_user_ip_cidrs
optional computed - set of string -
front_end_scale_factor
optional - number -
id
optional computed - string -
internal_load_balancing_mode
optional - string -
location
optional computed - string -
name
required - string -
pricing_tier
optional - string -
resource_group_name
optional computed - string -
subnet_id
required - string -
tags
optional - map from string to string -
user_whitelisted_ip_ranges
optional computed - set of string -
cluster_setting
list block -
timeouts
single block
Explanation in Terraform Registry
Manages an App Service Environment.
Tips: Best Practices for The Other Azure App Service (Web Apps) Resources
In addition to the azurerm_app_service, Azure App Service (Web Apps) has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
azurerm_app_service
Ensure your App Service is accessible via HTTPS only
It is better to configure the App Service to be accessible via HTTPS only. By default, both HTTP and HTTPS are available.
azurerm_function_app
Ensure to enable authentication to prevent anonymous request being accepted
It is better to enable authentication to prevent anonymous requests and ensure all communications in the application are authenticated.
Azure Resource Manager Example
Azure Resource Manager code does not have the related resource.
Frequently asked questions
What is Azure App Service (Web Apps) Environment?
Azure App Service (Web Apps) Environment is a resource for App Service (Web Apps) of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure App Service (Web Apps) Environment?
For Terraform, the gilyas/infracost, infracost/infracost and jactools/demo-terraform source code examples are useful. See the Terraform Example section for further details.