jolly-church-88521
11/10/2022, 4:17 PM}, pulumi.DependsOn([]pulumi.Resource{e.Cluster}))
but somehow it doesn’t work. Any hit? 😞billowy-army-68599
11/10/2022, 4:51 PMgray-fountain-32432
11/10/2022, 5:04 PMbillowy-army-68599
11/10/2022, 5:12 PMjolly-church-88521
11/10/2022, 7:38 PMfunc (e *EKSAddons) newServiceAccountRole(ctx *pulumi.Context, roleName string, serviceAccountName string, namespace string) (*iamv2.EKSRole, error) {
serviceAccount := fmt.Sprintf("%v:%v", namespace, serviceAccountName)
eksRole, err := iamv2.NewEKSRole(ctx, roleName, &iamv2.EKSRoleArgs{
Role: iamv2.RoleArgs{
Name: pulumi.String(roleName),
PolicyArns: pulumi.ToStringArray([]string{
"arn:aws:iam::aws:policy/AmazonRoute53DomainsFullAccess",
}),
},
Tags: pulumi.ToStringMap(map[string]string{
"Role": roleName,
}),
ClusterServiceAccounts: &iamv2.EKSServiceAccountArray{
iamv2.EKSServiceAccountArgs{
Name: pulumi.String(e.Name),
ServiceAccounts: pulumi.StringArray{
pulumi.String(serviceAccount),
},
},
},
}, pulumi.DependsOn([]pulumi.Resource{e.Cluster}))
if err != nil {
return nil, err
}
return eksRole, nil
}
e.Name
is a new EKS cluster which I want to create.billowy-army-68599
11/10/2022, 7:43 PMe
is type e *EKSAddons
e.Cluster
likely doesn’t exist on EKSAddons
?jolly-church-88521
11/10/2022, 7:45 PMpawelEKS, err := eksCluster.CreateInfrastructure(ctx, "pawels-eks", ...
_, err = eksAddons.CreateInfrastructure(ctx, "pawels-eks", pawelEKS)
if err != nil {
return err
}
pawels-eks
struct is:
type EKSCluster struct {
pulumi.ResourceState
Name string
Cluster *eks.Cluster
Providers pulumi.ResourceOption
InstanceProfile *iam.InstanceProfile
InstanceRole *iam.Role
UserRolesMapping eks.RoleMappingArray
Tags pulumi.StringMap
}
Diagnostics:
pulumi:pulumi:Stack (pawel-pre):
error: an unhandled error occurred: program failed:
waiting for RPCs: rpc error: code = Unknown desc = waiting for RPCs: marshaling properties: awaiting input property assumeRolePolicy: rpc error: code = Unknown desc = invocation of aws:eks/getCluster:getCluster returned an error: invoking aws:eks/getCluster:getCluster: 1 error occurred:
* error reading EKS Cluster (pawels-eks): couldn't find resource
billowy-army-68599
11/10/2022, 8:15 PMjolly-church-88521
11/12/2022, 3:13 PMname
should be a string.
And when I’m printing it I see the proper name of the EKS cluster. It started to work with this:
ClusterServiceAccounts: &iamv2.EKSServiceAccountArray{
iamv2.EKSServiceAccountArgs{
Name: e.Cluster.Core.Cluster().Name()
e.Cluster.Core.Cluster().Name()
works and just Name()
or "pawels-eks"
does not.pulumi.StringPtrInput
? 🤦♂️