Skip to content

Commit

Permalink
fix(aks): use soft dependency between cluster and data source (campto…
Browse files Browse the repository at this point in the history
…camp#855)

Get cluster name dynamically from cluster module outputs.
This allows modifying the cluster without breaking the data source.

Signed-off-by: Raphaël Pinson <raphael.pinson@camptocamp.com>
  • Loading branch information
raphink authored Feb 8, 2022
1 parent a858bc7 commit 7ee918a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions modules/aks/azure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,9 @@ data "azurerm_resource_group" "this" {
}

data "azurerm_kubernetes_cluster" "cluster" {
name = format("%s-aks", var.cluster_name)
# Get name dynamically from cluster_id to set soft dependency on cluster creation
name = element(reverse(split("/", module.cluster.aks_id)), 0)
resource_group_name = data.azurerm_resource_group.this.name

depends_on = [
module.cluster,
]
}

module "cluster" {
Expand Down

0 comments on commit 7ee918a

Please sign in to comment.