Hello I’m getting this error - Invalid value for “inputMap” parameter: lookup() requires a map as the first argument
I’m building new resources for the azure windows app app services. If I leave the site_config empty it works fine, however if I put any values in the site_config it will error out.
The current module looks like this:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.3.0"
}
}
}
module "win_app_service_module" {
depends_on = [
module.app_plan_module
]
source = "../../win_appservice"
win_app_services = {
app_service1 = {
name = "az_app_name"
resource_group_name = "az_rg_name"
service_plan_id = module.app_plan_module.asp_details.id
location = "centralus"
tags = {
product = "dev"
}
site_config = {
minimum_tls_version = "1.2"
}
}
}
}
variable win_app_services {
default = ""
description = "description"
}
resource "azurerm_windows_web_app" "main" {
for_each = var.win_app_services
name = each.value.name
location = each.value.location
resource_group_name = upper(each.value.resource_group_name)
service_plan_id = each.value.service_plan_id
app_settings = lookup(each.value, "app_settings", null)
client_affinity_enabled = lookup(each.value, "client_affinity_enabled", null)
client_certificate_enabled = lookup(each.value, "client_certificate_enabled", null)
client_certificate_mode = lookup(each.value, "client_certificate_mode", null)
enabled = lookup(each.value, "enabled", null)
https_only = lookup(each.value, "https_only", null)
tags = merge(each.value["tags"], var.additional_tags)
dynamic "connection_string" {
for_each = lookup(each.value, "connection_string", {})
content {
name = lookup(connection_string.value, "name", null)
type = lookup(connection_string.value, "type", null)
value = lookup(connection_string.value, "value", null)
}
}
dynamic "site_config" {
for_each = lookup(each.value, "site_config", {})
content {
scm_type = lookup(site_config.value, "scm_type", null)
always_on = lookup(site_config.value, "always_on", null)
api_management_api_id = lookup(site_config.value, "api_management_api_id", null)
app_command_line = lookup(site_config.value, "app_command_line", null)
auto_heal_enabled = lookup(site_config.value, "auto_heal_enabled", null)
container_registry_managed_identity_client_id = lookup(site_config.value, "container_registry_managed_identity_client_id", null)
container_registry_use_managed_identity = lookup(site_config.value, "container_registry_use_managed_identity", null)
local_mysql_enabled = lookup(site_config.value, "local_mysql_enabled", null)
default_documents = lookup(site_config.value, "default_documents", null) == null ? [] : [lookup(site_config.value, "default_documents", null)]
ftps_state = lookup(site_config.value, "ftps_state", null)
health_check_path = lookup(site_config.value, "health_check_path", null)
health_check_eviction_time_in_min = lookup(site_config.value, "health_check_eviction_time_in_min", null)
http2_enabled = lookup(site_config.value, "http2_enabled", null)
minimum_tls_version = lookup(site_config.value, "minimum_tls_version", null)
load_balancing_mode = lookup(site_config.value, "load_balancing_mode", null)
managed_pipeline_mode = lookup(site_config.value, "managed_pipeline_mode", null)
remote_debugging_version = lookup(site_config.value, "remote_debugging_version", null)
scm_minimum_tls_version = lookup(site_config.value, "scm_minimum_tls_version", null)
scm_use_main_ip_restriction = lookup(site_config.value, "scm_use_main_ip_restriction", null)
use_32_bit_worker = lookup(site_config.value, "use_32_bit_worker", null)
websockets_enabled = lookup(site_config.value, "websockets_enabled", null)
}
}
The error goes through each argument and claims site_config.value is 1.2, however it should just be tls version. This worked in older versions and I’m not sure what I’m missing.
│ Error: Invalid function argument
│
│ on .terraform\modules\win_app_service_module\win_appservice\main.tf line 226, in resource "azurerm_windows_web_app" "main":
│ 226: scm_type = lookup(site_config.value, "scm_type", null)
│ ├────────────────
│ │ site_config.value is "1.2"
│
│ Invalid value for "inputMap" parameter: lookup() requires a map as the
│ first argument.
╵
╷
│ Error: Invalid function argument
│
│ on .terraform\modules\win_app_service_module\win_appservice\main.tf line 227, in resource "azurerm_windows_web_app" "main":
│ 227: always_on = lookup(site_config.value, "always_on", null)
│ ├────────────────
│ │ site_config.value is "1.2"
│
│ Invalid value for "inputMap" parameter: lookup() requires a map as the
│ first argument.