Have developed a common module to create azure app service plan and app service for projects. In azurerm version 2 setting kind variable in app service plan resource with value linux or windows.
But with azurerm 3 upgrade there is one app service plan resource and 2 app services resources. Is there anyway to decide which resource be created depending on value of input variable apart from using count like below . Script Used
resource "azurerm_service_plan" "app_service_plan" {
name = local.name
location = var.location
resource_group_name = var.resource_group_name
tags = var.tags
os_type = var.os_type}
for windows
resource "azurerm_windows_web_app" "app_service" {
name = local.name
location = var.location
resource_group_name = var.resource_group_name
service_plan_id = var.app_service_plan_id
count = var.kind == "Windows" ?1:0}
for linux
resource "azurerm_linux_web_app" "app_service" {
name = local.name
location = var.location
resource_group_name = var.resource_group_name
service_plan_id = var.app_service_plan_id
count = var.kind == "Linux" ?1:0}