hi! I'm trying to get access to the ID of the `Nod...
# golang
l
hi! I'm trying to get access to the ID of the
NodeSecurityGroup
created by
eks.NewCluster
but the type returned is a
*SecurityGroupOutput
and I can't figure out how to get the ID output out of it to use with other resources
b
you should be able to just pass it to another resource, haev you tried? are you getting an error?
l
I'm trying to get it to
NewVpcEndpoint
, which takes a
StringArrayInput
for the
SecurityGroupIds
field and it wasn't clear how to convert it as there's no
ToStringOutput
method on
SecurityGroupOutput
and no obvious
ToStringArray*
function for this
Copy code
./main.go:71:48: cannot use cluster.NodeSecurityGroup (type "<http://github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2|github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2>".SecurityGroupOutput) as type pulumi.StringInput in slice literal:
        "<http://github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2|github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2>".SecurityGroupOutput does not implement pulumi.StringInput (missing ToStringOutput method)
I worked around this with
Copy code
// HACK: cluster.NodeSecurityGroup is a SecurityGroupOutput that doesn't have an accessible ID
	nodeSecurityGroupTag := cluster.ToClusterOutput().ApplyT(func(_ *eks.Cluster) string {
		// use ApplyT to build a StringOutput that depends on cluster
		return prefix + "-nodeSecurityGroup"
	}).(pulumi.StringOutput)
	nodeSecurityGroup := ec2.LookupSecurityGroupOutput(ctx, ec2.LookupSecurityGroupOutputArgs{
		Tags: pulumi.StringMap{"Name": nodeSecurityGroupTag},
	})
should I file an issue somewhere describing this use case?
b
I think that would help, yes. thank you
l
should it go in the eks repo or somewhere else?
b
EKS repo please!
👍🏻 1
l
hopefully that's clear!