https://pulumi.com logo
#azure
Title
# azure
e

early-oil-32855

08/01/2023, 9:55 AM
Hi folks, we currently have issues with a race condition when creating a new Azure Kubernetes Service with a dedicated Service Principal which is created before and used in the AKS' ServicePrincipalProfile. As you can see in the screenshot, we are already passing Pulumi resource bundles including DependsOn. Is there anything else we could check? Thanks!
Copy code
servicePrincipal, err := azuread.NewServicePrincipal(
		ctx,
		name,
		&azuread.ServicePrincipalArgs{
			ApplicationId: application.ApplicationId,
		},
		// ...ResourceOption params
		pulumi.DependsOn([]pulumi.Resource{application}),
		pulumi.Parent(application),
	)
			
	servicePrincipalPassword, err := azuread.NewServicePrincipalPassword(
		ctx,
		name,
		&azuread.ServicePrincipalPasswordArgs{
			DisplayName:        pulumi.String(name),
			EndDate:          pulumi.String("2099-01-01T00:00:00Z"),
			ServicePrincipalId: servicePrincipal.ID(),
		// ...ResourceOption params
		pulumi.DependsOn([]pulumi.Resource{servicePrincipal}),
		pulumi.Parent(servicePrincipal),
	)

    cluster, err := containerservice.NewManagedCluster(
...
			ServicePrincipalProfile: &containerservice.ManagedClusterServicePrincipalProfileArgs{
				ClientId: application.ApplicationId,
				Secret:   servicePrincipalPassword.Value,
			},
...
		},
		// ...ResourceOption params
		pulumi.DependsOn([]pulumi.Resource{servicePrincipal, servicePrincipalPassword}),