|
| 1 | +<!-- BEGIN_TF_DOCS --> |
| 2 | +<!-- Code generated by terraform-docs. DO NOT EDIT. --> |
| 3 | +# Multi-kind example |
| 4 | + |
| 5 | +This example deploys multiple App Service Plans with different SKU kinds to verify that the module correctly handles the `kind` property for each SKU type without configuration drift. |
| 6 | + |
| 7 | +The following plan types are tested: |
| 8 | + |
| 9 | +- **Standard (S1)**: Linux, kind = `"linux"` |
| 10 | +- **Premium (P1v2)**: Windows, kind = `"windows"` |
| 11 | +- **Flex Consumption (FC1)**: Linux, kind = `"functionapp"`, capacity managed by Azure |
| 12 | +- **Workflow Standard (WS1)**: Windows, kind = `"elastic"`, elasticScaleEnabled forced true |
| 13 | + |
| 14 | +```hcl |
| 15 | +terraform { |
| 16 | + required_version = ">= 1.9, < 2.0" |
| 17 | +
|
| 18 | + required_providers { |
| 19 | + azapi = { |
| 20 | + source = "Azure/azapi" |
| 21 | + version = "~> 2.4" |
| 22 | + } |
| 23 | + random = { |
| 24 | + source = "hashicorp/random" |
| 25 | + version = ">= 3.5.0, < 4.0.0" |
| 26 | + } |
| 27 | + } |
| 28 | +} |
| 29 | +
|
| 30 | +provider "azapi" {} |
| 31 | +
|
| 32 | +resource "random_integer" "region_index" { |
| 33 | + max = length(local.test_regions) - 1 |
| 34 | + min = 0 |
| 35 | +} |
| 36 | +
|
| 37 | +## End of section to provide a random Azure region for the resource group |
| 38 | +
|
| 39 | +# This ensures we have unique CAF compliant names for our resources. |
| 40 | +module "naming" { |
| 41 | + source = "Azure/naming/azurerm" |
| 42 | + version = "0.4.2" |
| 43 | +} |
| 44 | +
|
| 45 | +# This is required for resource modules |
| 46 | +# Hardcoding location due to quota constraints |
| 47 | +resource "azapi_resource" "resource_group" { |
| 48 | + location = "australiaeast" |
| 49 | + name = module.naming.resource_group.name_unique |
| 50 | + type = "Microsoft.Resources/resourceGroups@2024-03-01" |
| 51 | + response_export_values = [] |
| 52 | +} |
| 53 | +
|
| 54 | +# Deploy multiple App Service Plans with different SKU kinds |
| 55 | +module "test" { |
| 56 | + source = "../.." |
| 57 | + for_each = local.plans |
| 58 | +
|
| 59 | + location = azapi_resource.resource_group.location |
| 60 | + name = "${module.naming.app_service_plan.name_unique}-${each.key}" |
| 61 | + os_type = each.value.os_type |
| 62 | + parent_id = azapi_resource.resource_group.id |
| 63 | + enable_telemetry = var.enable_telemetry |
| 64 | + sku_name = each.value.sku_name |
| 65 | + worker_count = each.value.worker_count |
| 66 | + zone_balancing_enabled = each.value.zone_balancing |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +<!-- markdownlint-disable MD033 --> |
| 71 | +## Requirements |
| 72 | + |
| 73 | +The following requirements are needed by this module: |
| 74 | + |
| 75 | +- <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) (>= 1.9, < 2.0) |
| 76 | + |
| 77 | +- <a name="requirement_azapi"></a> [azapi](#requirement\_azapi) (~> 2.4) |
| 78 | + |
| 79 | +- <a name="requirement_random"></a> [random](#requirement\_random) (>= 3.5.0, < 4.0.0) |
| 80 | + |
| 81 | +## Resources |
| 82 | + |
| 83 | +The following resources are used by this module: |
| 84 | + |
| 85 | +- [azapi_resource.resource_group](https://registry.terraform.io/providers/Azure/azapi/latest/docs/resources/resource) (resource) |
| 86 | +- [random_integer.region_index](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/integer) (resource) |
| 87 | + |
| 88 | +<!-- markdownlint-disable MD013 --> |
| 89 | +## Required Inputs |
| 90 | + |
| 91 | +No required inputs. |
| 92 | + |
| 93 | +## Optional Inputs |
| 94 | + |
| 95 | +The following input variables are optional (have default values): |
| 96 | + |
| 97 | +### <a name="input_enable_telemetry"></a> [enable\_telemetry](#input\_enable\_telemetry) |
| 98 | + |
| 99 | +Description: This variable controls whether or not telemetry is enabled for the module. |
| 100 | +For more information see <https://aka.ms/avm/telemetryinfo>. |
| 101 | +If it is set to false, then no telemetry will be collected. |
| 102 | + |
| 103 | +Type: `bool` |
| 104 | + |
| 105 | +Default: `true` |
| 106 | + |
| 107 | +## Outputs |
| 108 | + |
| 109 | +The following outputs are exported: |
| 110 | + |
| 111 | +### <a name="output_plan_names"></a> [plan\_names](#output\_plan\_names) |
| 112 | + |
| 113 | +Description: Names of the deployed app service plans |
| 114 | + |
| 115 | +### <a name="output_plan_resource_ids"></a> [plan\_resource\_ids](#output\_plan\_resource\_ids) |
| 116 | + |
| 117 | +Description: Resource IDs of the deployed app service plans |
| 118 | + |
| 119 | +## Modules |
| 120 | + |
| 121 | +The following Modules are called: |
| 122 | + |
| 123 | +### <a name="module_naming"></a> [naming](#module\_naming) |
| 124 | + |
| 125 | +Source: Azure/naming/azurerm |
| 126 | + |
| 127 | +Version: 0.4.2 |
| 128 | + |
| 129 | +### <a name="module_test"></a> [test](#module\_test) |
| 130 | + |
| 131 | +Source: ../.. |
| 132 | + |
| 133 | +Version: |
| 134 | + |
| 135 | +<!-- markdownlint-disable-next-line MD041 --> |
| 136 | +## Data Collection |
| 137 | + |
| 138 | +The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices. |
| 139 | +<!-- END_TF_DOCS --> |
0 commit comments