Skip to content

Commit

Permalink
fix(aks): add dependencies to fix reading of storage account (#68)
Browse files Browse the repository at this point in the history
* fix(aks): add dependencies to fix reading of storage account

* docs(terraform-docs): generate docs and write to README.adoc

---------

Co-authored-by: lentidas <lentidas@users.noreply.github.com>
  • Loading branch information
lentidas and lentidas authored Jan 22, 2024
1 parent 2f9172e commit 128b0b8
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]] <<input_cluster_issuer,cluster_issuer>>

Expand Down Expand Up @@ -259,7 +259,7 @@ Description: ID to pass other modules in order to refer to this module as a depe
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v2.7.0"`
|`"v3.0.0"`
|no
|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
9 changes: 7 additions & 2 deletions aks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ The following requirements are needed by this module:

The following providers are used by this module:

- [[provider_null]] <<provider_null,null>> (>= 3)

- [[provider_azurerm]] <<provider_azurerm,azurerm>>

=== Modules
Expand All @@ -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)

Expand Down Expand Up @@ -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]] <<input_cluster_issuer,cluster_issuer>>

Expand Down Expand Up @@ -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]] <<provider_null,null>> |>= 3
|[[provider_azurerm]] <<provider_azurerm,azurerm>> |n/a
|===
Expand All @@ -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
|===
Expand Down Expand Up @@ -483,7 +488,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v2.7.0"`
|`"v3.0.0"`
|no
|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
14 changes: 14 additions & 0 deletions aks/main.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
# 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" {
count = local.use_managed_identity ? 1 : 0

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" {
Expand Down
4 changes: 2 additions & 2 deletions eks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]] <<input_cluster_issuer,cluster_issuer>>

Expand Down Expand Up @@ -457,7 +457,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v2.7.0"`
|`"v3.0.0"`
|no
|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
4 changes: 2 additions & 2 deletions kind/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]] <<input_cluster_issuer,cluster_issuer>>

Expand Down Expand Up @@ -393,7 +393,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v2.7.0"`
|`"v3.0.0"`
|no
|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
4 changes: 2 additions & 2 deletions sks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]] <<input_cluster_issuer,cluster_issuer>>

Expand Down Expand Up @@ -347,7 +347,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v2.7.0"`
|`"v3.0.0"`
|no
|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down

0 comments on commit 128b0b8

Please sign in to comment.