sparse-intern-71089
09/02/2021, 2:50 PMtall-librarian-49374
09/03/2021, 6:59 AMapply
missing somewhere in the chain.flaky-planet-42808
09/03/2021, 11:37 AMvar ingressAddOnProfileName = "ingressApplicationGateway";
var cluster = new ManagedCluster(
clusterName,
new ManagedClusterArgs
{
<SNIP>
AddonProfiles =
{
{
ingressAddOnProfileName,
new ManagedClusterAddonProfileArgs
{
Enabled = true,
Config = { { "applicationGatewayId", appGateway.Id } }
}
}
}
};
var agicReader = new RoleAssignment(cluster.AddonProfiles.Apply(x => x![ingressAddOnProfileName].Identity.ObjectId!), AzureBuiltInRole.Reader, resourceGroupName, roleName);
flaky-planet-42808
09/03/2021, 11:37 AMflaky-planet-42808
09/03/2021, 11:39 AMfailed with an unhandled exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at KubernetesCluster(string clusterName, string location, string environment, string environmentPrefix, Output<string> securityStorageAccountId, UserAssignedIdentity appGatewayIdentity, string clusterSubnetId, Output<string> loganalyticsWorkspaceId, PublicIPAddress appGatewayPublicIp)+(ImmutableDictionary<string, ManagedClusterAddonProfileResponse> x) => { } [2] in KubernetesCluster.cs:line 321
at Output<U> Pulumi.Output<T>.Apply<U>(Func<T, U> func)+(T t) => { }
at async Task<OutputData<U>> Pulumi.Output<T>.ApplyHelperAsync<U>(Task<OutputData<T>> dataTask, Func<T, Output<U>> func)
at async Task<OutputData<object>> Pulumi.Output<T>.Pulumi.IOutput.GetDataAsync()
at async Task<object> Pulumi.Serialization.Serializer.SerializeAsync(string ctx, object prop, bool keepResources) x 2
at async Task<SerializationResult> Pulumi.Deployment.SerializeFilteredPropertiesAsync(string label, IDictionary<string, object> args, Predicate<string> acceptKey, bool keepResources)
at async Task<PrepareResult> Pulumi.Deployment.PrepareResourceAsync(string label, Resource res, bool custom, bool remote, ResourceArgs args, ResourceOptions options)
at async Task<(string urn, string id, Struct data, ImmutableDictionary<string, ImmutableHashSet<Resource>> dependencies)> Pulumi.Deployment.RegisterResourceAsync(Resource resource, bool remote, Func<string, Resource> newDependency, ResourceArgs args, ResourceOptions options)
at async Task<(string urn, string id, Struct data, ImmutableDictionary<string, ImmutableHashSet<Resource>> dependencies)> Pulumi.Deployment.ReadOrRegisterResourceAsync(Resource resource, bool remote, Func<string, Resource> newDependency, ResourceArgs args, ResourceOptions options)
at async Task Pulumi.Deployment.CompleteResourceAsync(Resource resource, bool remote, Func<string, Resource> newDependency, ResourceArgs args, ResourceOptions options, ImmutableDictionary<string, IOutputCompletionSource> completionSources)
flaky-planet-42808
09/03/2021, 11:41 AMtall-librarian-49374
09/03/2021, 2:18 PMimportant-book-47803
09/06/2021, 4:57 PMflaky-planet-42808
09/14/2021, 4:16 PMApply
, also made role assignment function to explicitly depend on the cluster by using CustomResourceOptions { DependsOn = cluster }
- so that the role assignments wouldn’t run before cluster creation during preview.
var ReaderAssignment = cluster.AddonProfiles.Apply(
x => new RoleAssignment(x![ingressAddOnProfileName].Identity.ObjectId!, AzureBuiltInRole.Reader, ApplicationResourceGroup.GetResourceGroupId(environment), $"{clusterName}-agic-reader-assignment", cluster));
tall-librarian-49374
09/14/2021, 8:31 PMApply
is generally discouraged as your previews may not be accurate. I’m fairly sure you could produce inputs in Apply and then assign them to RoleAssignment
at the top level. Let me know if you need help with that.No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by