From 1e394996d70e0324c2d8200991a57f0ac43c45e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Heleno?= Date: Mon, 22 Jan 2024 11:59:55 +0100 Subject: [PATCH] fix(aks): add dependencies to fix reading of storage account --- aks/main.tf | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/aks/main.tf b/aks/main.tf index fb409d6d..d6d332c2 100644 --- a/aks/main.tf +++ b/aks/main.tf @@ -1,7 +1,17 @@ +# This null_resource is required otherwise Terraform would try to read the resource group data and/or the storage +# account even if they were not created yet. +resource "null_resource" "dependencies" { + triggers = var.dependency_ids +} + data "azurerm_resource_group" "node_resource_group" { count = local.use_managed_identity ? 1 : 0 name = var.metrics_storage.managed_identity_node_rg_name + + depends_on = [ + resource.null_resource.dependencies + ] } data "azurerm_storage_container" "container" { @@ -9,6 +19,10 @@ data "azurerm_storage_container" "container" { name = var.metrics_storage.container storage_account_name = var.metrics_storage.storage_account + + depends_on = [ + resource.null_resource.dependencies + ] } resource "azurerm_user_assigned_identity" "thanos" {