From 88d524b952860a7dcca1e6a7a52aadb84ca2cf68 Mon Sep 17 00:00:00 2001 From: Tom Archer Date: Wed, 24 May 2023 11:59:56 -0700 Subject: [PATCH] Made edits per Code Review --- quickstart/201-k8s-cluster-with-tf-and-aks/main.tf | 2 ++ quickstart/201-k8s-cluster-with-tf-and-aks/providers.tf | 4 ++++ quickstart/201-k8s-cluster-with-tf-and-aks/sp.tf | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/quickstart/201-k8s-cluster-with-tf-and-aks/main.tf b/quickstart/201-k8s-cluster-with-tf-and-aks/main.tf index 1af8c303..5fc878bd 100644 --- a/quickstart/201-k8s-cluster-with-tf-and-aks/main.tf +++ b/quickstart/201-k8s-cluster-with-tf-and-aks/main.tf @@ -72,4 +72,6 @@ resource "azurerm_kubernetes_cluster" "k8s" { client_id = azuread_service_principal.app.application_id client_secret = azuread_service_principal_password.app.value } + + depends_on = [time_sleep.wait_30_seconds] } \ No newline at end of file diff --git a/quickstart/201-k8s-cluster-with-tf-and-aks/providers.tf b/quickstart/201-k8s-cluster-with-tf-and-aks/providers.tf index cfba5824..7eff0179 100644 --- a/quickstart/201-k8s-cluster-with-tf-and-aks/providers.tf +++ b/quickstart/201-k8s-cluster-with-tf-and-aks/providers.tf @@ -14,6 +14,10 @@ terraform { source = "hashicorp/random" version = "~>3.0" } + time = { + source = "hashicorp/time" + version = "0.9.1" + } } } diff --git a/quickstart/201-k8s-cluster-with-tf-and-aks/sp.tf b/quickstart/201-k8s-cluster-with-tf-and-aks/sp.tf index 6d96548e..adde9182 100644 --- a/quickstart/201-k8s-cluster-with-tf-and-aks/sp.tf +++ b/quickstart/201-k8s-cluster-with-tf-and-aks/sp.tf @@ -16,6 +16,15 @@ resource "azuread_service_principal_password" "app" { service_principal_id = azuread_service_principal.app.id } +# Sleep for 30 seconds to allow for propagation +# of the Service Principal creation before attempting +# to create the AKS cluster. +resource "time_sleep" "wait_30_seconds" { + create_duration = "30s" + + depends_on = [azuread_service_principal_password.app] +} + # Output the Service Principal and password output "sp" { value = azuread_service_principal.app.id