sparse-intern-71089
06/30/2021, 12:59 AMlittle-cartoon-10569
06/30/2021, 3:26 AMbright-sandwich-93783
06/30/2021, 3:39 AMbright-sandwich-93783
06/30/2021, 3:39 AMbillowy-army-68599
billowy-army-68599
bright-sandwich-93783
06/30/2021, 9:02 PMGetCertificate)bright-sandwich-93783
06/30/2021, 9:03 PMbright-sandwich-93783
06/30/2021, 9:04 PMbright-sandwich-93783
06/30/2021, 9:04 PMbillowy-army-68599
bright-sandwich-93783
06/30/2021, 9:08 PMbright-sandwich-93783
06/30/2021, 9:09 PMbright-sandwich-93783
06/30/2021, 9:09 PMbillowy-army-68599
bright-sandwich-93783
06/30/2021, 9:17 PMbright-sandwich-93783
06/30/2021, 9:19 PMClusterIdentity Oidcs blockbright-sandwich-93783
06/30/2021, 9:20 PMbillowy-army-68599
bright-sandwich-93783
06/30/2021, 10:35 PMbillowy-army-68599
bright-sandwich-93783
06/30/2021, 11:00 PMpackage main
import (
"github.com/pulumi/pulumi-aws/sdk/v3/go/aws/eks"
"github.com/pulumi/pulumi-aws/sdk/v3/go/aws/iam"
"github.com/pulumi/pulumi-tls/sdk/v4/go/tls"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleCluster, err := eks.NewCluster(ctx, "exampleCluster", nil)
if err != nil {
return err
}
exampleCert, err := tls.GetCertificate(ctx, tls.GetCertificateArgs {
Url: exampleCluster.Identities[0].Url
})
_, err = iam.NewOpenIdConnectProvider(ctx, "exampleOpenIdConnectProvider", &iam.OpenIdConnectProviderArgs{
ClientIdLists: pulumi.StringArray{
pulumi.String("sts.amazonaws.com"),
},
ThumbprintLists: pulumi.StringArray{
exampleCertificate.ApplyT(func(exampleCertificate tls.GetCertificateResult) (string, error) {
return exampleCertificate.Certificates[0].Sha1Fingerprint, nil
}).(pulumi.StringOutput),
},
Url: pulumi.String(exampleCluster.Identities.ApplyT(func(identities []eks.ClusterIdentity) (string, error) {
return identities[0].Oidcs[0].Issuer, nil
}).(pulumi.StringOutput)),
})
if err != nil {
return err
}
return nil
})
}bright-sandwich-93783
06/30/2021, 11:02 PMexampleCert is pseudocode, because I couldn't figure out a way to get the actual string value of the issuer URL, unless I wanted to make the GetCertificate call inside of an ApplyT callback...
Thoughts?billowy-army-68599
ApplyT, we try not to recommend it because it won't show up in previews, but it should worklittle-cartoon-10569
06/30/2021, 11:06 PMbright-sandwich-93783
06/30/2021, 11:06 PMstring value for the URL, not a StringOutput/Inputbright-sandwich-93783
06/30/2021, 11:07 PMeksCluster.Identities.Index(pulumi.Int(0)).Oidcs().Index(pulumi.Int(0)).Issuer().Elem(),little-cartoon-10569
06/30/2021, 11:07 PMbright-sandwich-93783
06/30/2021, 11:07 PMApplyT callback, at which point you could make the call to tls.GetCertificatebright-sandwich-93783
06/30/2021, 11:08 PMbright-sandwich-93783
06/30/2021, 11:08 PMGetCertificate is a vanilla go structbright-sandwich-93783
06/30/2021, 11:08 PMlittle-cartoon-10569
06/30/2021, 11:09 PM