To create the module, perform the following steps:
- In a new folder called moduledemo, create the Modules and webapp folders.
- In the webapp folder, create a new variables.tf file with the following code:
variable "resource_group_name" {
description = "Resource group name"
}
variable "location" {
description = "Location of Azure resource"
default = "West Europe"
}
variable "service_plan_name" {
description = "Service plan name"
}
variable "app_name" {
description = "Name of application"
}
- Then, create the main.tf file with the following code:
resource "azurerm_app_service_plan" "plan-app" {
name = var.service_plan_name
location = var.location
resource_group_name = var.resource_group_name
sku {
tier = "Standard"
size = "S1"
}
}
resource "azurerm_app_service" "app" {
...