Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pause between pod identity installation and creation of the AzureIdentity #12

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
locals {
##
# If CRDs are installed and we are going to create AzureIdentity right away
# set a pause time between installation of pod identity and the creation
# of the AzureIdentity. Otherwise there is a chance of failure.
identity_creation_quiessence_time_in_secs = var.install_crds && var.identities != null ? 30 : 1

}
11 changes: 10 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,18 @@ resource "helm_release" "aad_pod_identity" {
EOF
]
}
##
# Give a little time after pod identity completes for the custom
# CRDs (AzureIdentity) to be registered in K8s so that any
# subsequent identity creatation will succeed.
resource "time_sleep" "wait_for_pod_identity" {
depends_on = [ helm_release.aad_pod_identity ]

create_duration = "${local.identity_creation_quiessence_time_in_secs}s"
}

module "identity" {
depends_on = [ helm_release.aad_pod_identity ]
depends_on = [ time_sleep.wait_for_pod_identity ]
source = "./identity"
for_each = (var.identities == null ? {} : var.identities)

Expand Down