Referencing a string array from data

I am trying to implement a cluster similar to this:

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_cluster

My difficulty comes in trying to create the IAM roles, specifically replicating this resource in CDK. Example below.

resource "aws_iam_openid_connect_provider" "example" {
  client_id_list  = ["sts.amazonaws.com"]
  thumbprint_list = data.tls_certificate.example.certificates[*].sha1_fingerprint
  url             = data.tls_certificate.example.url
}

My code looks like this

this.cluster = new aws.eksCluster.EksCluster(this, id, {
      name: id,
      roleArn: clusterRole.arn,
      vpcConfig: {
        subnetIds: props.subnetIds
      },
      dependsOn: [clusterRole, clusterRoleAttachment]
    })

    const tlsCert = new tls.dataTlsCertificate.DataTlsCertificate(this, "tls", {
      url: this.cluster.identity.get(0).oidc.get(0).issuer
    })

    const provider = new aws.iamOpenidConnectProvider.IamOpenidConnectProvider(this, "provider", {
      clientIdList: ["sts.amazonaws.com"],
      // HELP NEEEDED HERE
      thumbprintList: [], // ${data.tls_certificate.tls.certificates[*].sha1_fingerprint}
      url: tlsCert.url,
    })

What is the proper syntax to refer to a string array from a list of data elements?

I solved this by doing the following. Let me know if there is a better way to handle this:

    const tlsCert = new tls.dataTlsCertificate.DataTlsCertificate(this, 'tls', {
      url: this.cluster.identity.get(0).oidc.get(0).issuer,
    });

    const provider = new aws.iamOpenidConnectProvider.IamOpenidConnectProvider(
      this,
      'provider',
      {
        clientIdList: ['sts.amazonaws.com'],
        thumbprintList: [], // ${data.tls_certificate.tls.certificates[*].sha1_fingerprint}
        url: tlsCert.url,
      }
    );

    provider.addOverride(
      'thumbprint_list',
      `\${data.tls_certificate.${tlsCert.friendlyUniqueId}.certificates[*].sha1_fingerprint}`
    );

Yeah, that’s pretty much the only way right now. Feel free to give Support accessing resources created by an iterator · Issue #2024 · hashicorp/terraform-cdk · GitHub a thumbsup for improving the functionality.