From 128b0b839790c89cdcdde4d65c5a6b9812e1a34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Heleno?= <33546359+lentidas@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:01:05 +0100 Subject: [PATCH] fix(aks): add dependencies to fix reading of storage account (#68) * fix(aks): add dependencies to fix reading of storage account * docs(terraform-docs): generate docs and write to README.adoc --------- Co-authored-by: lentidas --- README.adoc | 4 ++-- aks/README.adoc | 9 +++++++-- aks/main.tf | 14 ++++++++++++++ eks/README.adoc | 4 ++-- kind/README.adoc | 4 ++-- sks/README.adoc | 4 ++-- 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/README.adoc b/README.adoc index a8555567..2814793f 100644 --- a/README.adoc +++ b/README.adoc @@ -105,7 +105,7 @@ Description: Override of target revision of the application chart. Type: `string` -Default: `"v2.7.0"` +Default: `"v3.0.0"` ==== [[input_cluster_issuer]] <> @@ -259,7 +259,7 @@ Description: ID to pass other modules in order to refer to this module as a depe |[[input_target_revision]] <> |Override of target revision of the application chart. |`string` -|`"v2.7.0"` +|`"v3.0.0"` |no |[[input_cluster_issuer]] <> diff --git a/aks/README.adoc b/aks/README.adoc index 81ea8b0a..58b00ed2 100644 --- a/aks/README.adoc +++ b/aks/README.adoc @@ -219,6 +219,8 @@ The following requirements are needed by this module: The following providers are used by this module: +- [[provider_null]] <> (>= 3) + - [[provider_azurerm]] <> === Modules @@ -238,6 +240,7 @@ The following resources are used by this module: - https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/federated_identity_credential[azurerm_federated_identity_credential.thanos] (resource) - https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment[azurerm_role_assignment.storage_contributor] (resource) - https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/user_assigned_identity[azurerm_user_assigned_identity.thanos] (resource) +- https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.dependencies] (resource) - https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group[azurerm_resource_group.node_resource_group] (data source) - https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_container[azurerm_storage_container.container] (data source) @@ -307,7 +310,7 @@ Description: Override of target revision of the application chart. Type: `string` -Default: `"v2.7.0"` +Default: `"v3.0.0"` ==== [[input_cluster_issuer]] <> @@ -404,6 +407,7 @@ Description: ID to pass other modules in order to refer to this module as a depe [cols="a,a",options="header,autowidth"] |=== |Name |Version +|[[provider_null]] <> |>= 3 |[[provider_azurerm]] <> |n/a |=== @@ -423,6 +427,7 @@ Description: ID to pass other modules in order to refer to this module as a depe |https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/federated_identity_credential[azurerm_federated_identity_credential.thanos] |resource |https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment[azurerm_role_assignment.storage_contributor] |resource |https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/user_assigned_identity[azurerm_user_assigned_identity.thanos] |resource +|https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.dependencies] |resource |https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group[azurerm_resource_group.node_resource_group] |data source |https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_container[azurerm_storage_container.container] |data source |=== @@ -483,7 +488,7 @@ object({ |[[input_target_revision]] <> |Override of target revision of the application chart. |`string` -|`"v2.7.0"` +|`"v3.0.0"` |no |[[input_cluster_issuer]] <> 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" { diff --git a/eks/README.adoc b/eks/README.adoc index 610b27fd..62824439 100644 --- a/eks/README.adoc +++ b/eks/README.adoc @@ -303,7 +303,7 @@ Description: Override of target revision of the application chart. Type: `string` -Default: `"v2.7.0"` +Default: `"v3.0.0"` ==== [[input_cluster_issuer]] <> @@ -457,7 +457,7 @@ object({ |[[input_target_revision]] <> |Override of target revision of the application chart. |`string` -|`"v2.7.0"` +|`"v3.0.0"` |no |[[input_cluster_issuer]] <> diff --git a/kind/README.adoc b/kind/README.adoc index aa816145..1da983c1 100644 --- a/kind/README.adoc +++ b/kind/README.adoc @@ -237,7 +237,7 @@ Description: Override of target revision of the application chart. Type: `string` -Default: `"v2.7.0"` +Default: `"v3.0.0"` ==== [[input_cluster_issuer]] <> @@ -393,7 +393,7 @@ object({ |[[input_target_revision]] <> |Override of target revision of the application chart. |`string` -|`"v2.7.0"` +|`"v3.0.0"` |no |[[input_cluster_issuer]] <> diff --git a/sks/README.adoc b/sks/README.adoc index 52bbf2d5..ebd7413f 100644 --- a/sks/README.adoc +++ b/sks/README.adoc @@ -186,7 +186,7 @@ Description: Override of target revision of the application chart. Type: `string` -Default: `"v2.7.0"` +Default: `"v3.0.0"` ==== [[input_cluster_issuer]] <> @@ -347,7 +347,7 @@ object({ |[[input_target_revision]] <> |Override of target revision of the application chart. |`string` -|`"v2.7.0"` +|`"v3.0.0"` |no |[[input_cluster_issuer]] <>