How can I associate an IAM OIDC Identity Provider with an EKS cluster with CDK?

Viewed 484

I can't figure out how to replicate the functionality of the "Associate Identity Provider" button on AWS console screen pictured below with CDK.

enter image description here

1 Answers

You actually don't need to specify it, it is made automatically

exemple of Go CDK code

func SetKubernetesCluster(stack constructs.Construct) *awseks.Cluster {

    cluster := awseks.NewCluster(stack, jsii.String("nft"), &awseks.ClusterProps{
        ClusterName:         jsii.String("nft"),
        Version:             awseks.KubernetesVersion_V1_21(),
        OutputClusterName:   jsii.Bool(true),
        OutputConfigCommand: jsii.Bool(true),
    })


    awscdk.NewCfnOutput(stack, jsii.String("OIDC-issuer"), &awscdk.CfnOutputProps{
        Value: cluster.ClusterOpenIdConnectIssuer(),
    })
    awscdk.NewCfnOutput(stack, jsii.String("OIDC-endpoint-url"), &awscdk.CfnOutputProps{
        Value: cluster.ClusterOpenIdConnectIssuerUrl(),
    })

    return &cluster
}
Related