From f0f5d470289f467d0d92ed3f63bed56d17dfe193 Mon Sep 17 00:00:00 2001 From: Simon Schneider Date: Mon, 29 Jul 2024 08:56:53 +0000 Subject: [PATCH] fix: inconsistent types in conditional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2024/07/29 06:57:53 Error: Inconsistent conditional result types 2024/07/29 06:57:53 2024/07/29 06:57:53 on /home/AzDevOps_azpcontainer/.terraform/modules/stage2/modules/messaging/web_pubsub/private_endpoint.tf line 11, in module "private_endpoint": 2024/07/29 06:57:53 11: private_dns = can(each.value.private_dns) ? var.remote_objects.private_dns : {} 2024/07/29 06:57:53 ├──────────────── 2024/07/29 06:57:53 │ each.value.private_dns is object with 2 attributes 2024/07/29 06:57:53 │ var.remote_objects.private_dns is object with 5 attributes 2024/07/29 06:57:53 2024/07/29 06:57:53 The true and false result expressions must have consistent types. The 'true' 2024/07/29 06:57:53 value includes object attribute "devops", which is absent in the 'false' We don't need the condition here, as the private_dns variable will only act as a resource reference and the decision making will be done by the var.settings.private_dns parameter --- modules/messaging/web_pubsub/private_endpoint.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/messaging/web_pubsub/private_endpoint.tf b/modules/messaging/web_pubsub/private_endpoint.tf index ae1d455277..9d95616fa1 100644 --- a/modules/messaging/web_pubsub/private_endpoint.tf +++ b/modules/messaging/web_pubsub/private_endpoint.tf @@ -8,7 +8,7 @@ module "private_endpoint" { global_settings = var.global_settings location = local.location name = each.value.name - private_dns = can(each.value.private_dns) ? var.remote_objects.private_dns : {} + private_dns = var.remote_objects.private_dns resource_groups = var.remote_objects.resource_groups resource_id = azurerm_web_pubsub.wps.id settings = each.value