From 3d9bb3e79d3e3c315b3ce19ce4a0308d30ac6107 Mon Sep 17 00:00:00 2001 From: Anmol Nagpal Date: Mon, 8 May 2023 23:04:06 +0530 Subject: [PATCH] fix: Added variable for controlling key_creation --- main.tf | 2 +- variables.tf | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 7c12140..e5debe3 100644 --- a/main.tf +++ b/main.tf @@ -226,7 +226,7 @@ resource "azurerm_role_assignment" "rbac_user_assigned" { resource "azurerm_key_vault_key" "example" { depends_on = [azurerm_key_vault.key_vault, ] - count = var.enabled ? 1 : 0 + count = var.enabled && var.key_enabled ? 1 : 0 name = format("mid-keyvault-%s", module.labels.id) key_vault_id = join("", azurerm_key_vault.key_vault.*.id) key_type = "RSA" diff --git a/variables.tf b/variables.tf index 4cac01b..c2403b8 100644 --- a/variables.tf +++ b/variables.tf @@ -312,3 +312,8 @@ variable "multi_sub_vnet_link" { description = "Flag to control creation of vnet link for dns zone in different subscription" } +variable "key_enabled" { + type = bool + default = false + description = "Flag to control creation of key vault key resource." +}