w

    worried-city-86458

    6 months ago
    I'm hitting an issue with https://github.com/pulumi/pulumi-aws/releases/tag/v5.0.0 with the change to eks cluster certificate authorities
    It changed to an array but update fails with null reference exception after I change the code to use an array
    From:
    KubeConfig = Output.Tuple(cluster.Name, clusterEndpoint, cluster.CertificateAuthority.Apply(ca => ca.Data!))
                .Apply(((string ClusterName, string ClusterEndpoint, string ClusterCa) tuple) =>
                    RenderTemplate("KubeConfig.yaml", ReadResource, new { tuple.ClusterName, tuple.ClusterEndpoint, tuple.ClusterCa, EnvName, AwsConfig.Iam.DeployerRoleArn }))
                .Apply(Output.CreateSecret);
    To:
    KubeConfig = Output.Tuple(cluster.Name, clusterEndpoint, cluster.CertificateAuthorities.Apply(authorities => authorities[0].Data!))
                .Apply(((string ClusterName, string ClusterEndpoint, string ClusterCa) tuple) =>
                    RenderTemplate("KubeConfig.yaml", ReadResource, new { tuple.ClusterName, tuple.ClusterEndpoint, tuple.ClusterCa, EnvName, AwsConfig.Iam.DeployerRoleArn }))
                .Apply(Output.CreateSecret);
    Exception:
    Diagnostics:
      pulumi:pulumi:Stack (aws-eks-alpha):
        error: Running program '' failed with an unhandled exception:
        System.NullReferenceException: Object reference not set to an instance of an object.
           at T System.Collections.Immutable.ImmutableArray<T>.get_Item(int index)
           at Pharos.Gemini.Aws.EksStack(IOptions<Config> options, ILogger<EksStack> logger)+(ImmutableArray<ClusterCertificateAuthority> cas) => { }
           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)
    Looks like
    CertificateAuthorities
    is null
    Existing state has
    certificateAuthority
    not
    certificateAuthorities
    so is there something else I need to do to upgrade to v5?
    This looks similar to how
    Identities
    is handled which works fine and makes me think pulumi needs to do something else to map the certificate authorities
    @broad-dog-22463 any ideas?