miniature-leather-70472
06/02/2021, 10:54 AMnew Authorization.RoleAssignment($"{name}-aks-subnet-aci-role", new Authorization.RoleAssignmentArgs
{
RoleAssignmentName = new RandomUuid($"{name}-Network-Contributor-Aci-Uuid").Result,
Scope = args.ResourceGroupId,
PrincipalId = aks.AddonProfiles.Apply(profiles => profiles!["AciConnectorLinux"].Identity.ObjectId),
RoleDefinitionId = roleDefinitionId,
PrincipalType = Authorization.PrincipalType.ServicePrincipal
}
Pulumi preview is failing on this line:
PrincipalId = aks.AddonProfiles.Apply(profiles => profiles!["AciConnectorLinux"].Identity.ObjectId),
With this error:
System.NullReferenceException: Object reference not set to an instance of an object.
`at Ict.AzureNative.Containers.IctAzureKubernetesCluster.<>c.<.ctor>b__32_7(ImmutableDictionary`2 profiles) in C:\repos\ict-azure-native\src\ict-azure-native\Containers\IctAzureKubernetesCluster.cs:line 254`
Given that this identity is not known until the cluster is created, it is expected to be empty in the initial preview, so why is it trying to work it out rather than waiting on AKS to create first?profiles!["AciConnectorLinux"]
is not null at preview time, but it doesn't have any sub properties, including identity. If I do a check for identity being null then this works, however now when I try and re-run the code the preview shows it wants to delete the role assignment because it's not in the preview