|
4 | 4 | This deploys the module as a Linux Web App utilizing auto heal settings. |
5 | 5 |
|
6 | 6 | ```hcl |
7 | | -## Section to provide a random Azure region for the resource group |
8 | | -# This allows us to randomize the region for the resource group. |
9 | | -module "regions" { |
10 | | - source = "Azure/regions/azurerm" |
11 | | - version = ">= 0.8.0" |
12 | | -} |
13 | | -
|
14 | | -# This allows us to randomize the region for the resource group. |
| 7 | +## Section to provide a random Azure region for the resource group |
| 8 | +# This allows us to randomize the region for the resource group. |
| 9 | +module "regions" { |
| 10 | + source = "Azure/regions/azurerm" |
| 11 | + version = ">= 0.8.0" |
| 12 | +} |
| 13 | +
|
| 14 | +# This allows us to randomize the region for the resource group. |
15 | 15 | resource "random_integer" "region_index" { |
16 | | - max = length(local.azure_regions) - 1 |
17 | | - min = 0 |
18 | | -} |
19 | | -## End of section to provide a random Azure region for the resource group |
20 | | -
|
21 | | -# This ensures we have unique CAF compliant names for our resources. |
22 | | -module "naming" { |
23 | | - source = "Azure/naming/azurerm" |
24 | | - version = ">= 0.3.0" |
25 | | -} |
26 | | -
|
| 16 | + max = length(local.azure_regions) - 1 |
| 17 | + min = 0 |
| 18 | +} |
| 19 | +## End of section to provide a random Azure region for the resource group |
| 20 | +
|
| 21 | +# This ensures we have unique CAF compliant names for our resources. |
| 22 | +module "naming" { |
| 23 | + source = "Azure/naming/azurerm" |
| 24 | + version = ">= 0.3.0" |
| 25 | +} |
| 26 | +
|
27 | 27 | resource "azurerm_resource_group" "example" { |
28 | | - location = local.azure_regions[random_integer.region_index.result] |
29 | | - name = module.naming.resource_group.name_unique |
30 | | -} |
31 | | -
|
| 28 | + location = local.azure_regions[random_integer.region_index.result] |
| 29 | + name = module.naming.resource_group.name_unique |
| 30 | +} |
| 31 | +
|
32 | 32 | resource "azurerm_service_plan" "example" { |
33 | | - location = azurerm_resource_group.example.location |
34 | | - name = module.naming.app_service_plan.name_unique |
35 | | - os_type = "Linux" |
36 | | - resource_group_name = azurerm_resource_group.example.name |
37 | | - sku_name = "P1v2" |
38 | | - tags = { |
39 | | - app = "${module.naming.function_app.name_unique}-default" |
40 | | - } |
41 | | -} |
42 | | -
|
43 | | -module "avm_res_web_site" { |
44 | | - source = "../../" |
45 | | -
|
46 | | - # source = "Azure/avm-res-web-site/azurerm" |
47 | | - # version = "0.15.1" |
48 | | -
|
49 | | - enable_telemetry = var.enable_telemetry |
50 | | -
|
51 | | - name = "${module.naming.function_app.name_unique}-auto-heal" |
52 | | - resource_group_name = azurerm_resource_group.example.name |
53 | | - location = azurerm_resource_group.example.location |
54 | | -
|
55 | | - kind = "webapp" |
56 | | -
|
57 | | - os_type = azurerm_service_plan.example.os_type |
58 | | - service_plan_resource_id = azurerm_service_plan.example.id |
59 | | -
|
60 | | - site_config = { |
61 | | -
|
62 | | - } |
63 | | - auto_heal_setting = { # auto_heal_setting should only be specified if auto_heal_enabled is set to `true` |
64 | | - setting_1 = { |
65 | | - action = { |
66 | | - action_type = "Recycle" |
67 | | - minimum_process_execution_time = "00:01:00" |
68 | | - } |
69 | | - trigger = { |
70 | | - requests = { |
71 | | - count = 100 |
72 | | - interval = "00:00:30" |
73 | | - } |
74 | | - status_code = { |
75 | | - status_5000 = { |
76 | | - count = 5000 |
77 | | - interval = "00:05:00" |
78 | | - path = "/HealthCheck" |
79 | | - status_code_range = 500 |
80 | | - sub_status = 0 |
81 | | - } |
82 | | - status_6000 = { |
83 | | - count = 6000 |
84 | | - interval = "00:05:00" |
85 | | - path = "/Get" |
86 | | - status_code_range = 500 |
87 | | - sub_status = 0 |
88 | | - } |
89 | | - } |
90 | | - } |
91 | | - } |
92 | | - } |
93 | | -} |
| 33 | + location = azurerm_resource_group.example.location |
| 34 | + name = module.naming.app_service_plan.name_unique |
| 35 | + os_type = "Linux" |
| 36 | + resource_group_name = azurerm_resource_group.example.name |
| 37 | + sku_name = "P1v2" |
| 38 | + tags = { |
| 39 | + app = "${module.naming.function_app.name_unique}-default" |
| 40 | + } |
| 41 | +} |
| 42 | +
|
| 43 | +module "avm_res_web_site" { |
| 44 | + source = "../../" |
| 45 | +
|
| 46 | + # source = "Azure/avm-res-web-site/azurerm" |
| 47 | + # version = "0.15.2" |
| 48 | +
|
| 49 | + enable_telemetry = var.enable_telemetry |
| 50 | +
|
| 51 | + name = "${module.naming.function_app.name_unique}-auto-heal" |
| 52 | + resource_group_name = azurerm_resource_group.example.name |
| 53 | + location = azurerm_resource_group.example.location |
| 54 | +
|
| 55 | + kind = "webapp" |
| 56 | +
|
| 57 | + os_type = azurerm_service_plan.example.os_type |
| 58 | + service_plan_resource_id = azurerm_service_plan.example.id |
| 59 | +
|
| 60 | + site_config = { |
| 61 | +
|
| 62 | + } |
| 63 | + auto_heal_setting = { # auto_heal_setting should only be specified if auto_heal_enabled is set to `true` |
| 64 | + setting_1 = { |
| 65 | + action = { |
| 66 | + action_type = "Recycle" |
| 67 | + minimum_process_execution_time = "00:01:00" |
| 68 | + } |
| 69 | + trigger = { |
| 70 | + requests = { |
| 71 | + count = 100 |
| 72 | + interval = "00:00:30" |
| 73 | + } |
| 74 | + status_code = { |
| 75 | + status_5000 = { |
| 76 | + count = 5000 |
| 77 | + interval = "00:05:00" |
| 78 | + path = "/HealthCheck" |
| 79 | + status_code_range = 500 |
| 80 | + sub_status = 0 |
| 81 | + } |
| 82 | + status_6000 = { |
| 83 | + count = 6000 |
| 84 | + interval = "00:05:00" |
| 85 | + path = "/Get" |
| 86 | + status_code_range = 500 |
| 87 | + sub_status = 0 |
| 88 | + } |
| 89 | + } |
| 90 | + } |
| 91 | + } |
| 92 | + } |
| 93 | +} |
94 | 94 | ``` |
95 | 95 |
|
96 | 96 | <!-- markdownlint-disable MD033 --> |
|
0 commit comments