https://pulumi.com logo
#general
Title
# general
d

damp-room-71337

08/22/2019, 10:35 AM
am I missing something, or is there no way to specify a name for an EKS cluster with Pulumi?
b

broad-dog-22463

08/22/2019, 10:54 AM
How does your resource look like?
d

damp-room-71337

08/22/2019, 10:57 AM
Copy code
// EKS Cluster
const cluster = new eks.Cluster("test-cluster", {
  name: "test-cluster",
  version: "1.13",
  vpcId: vpcId,
  subnetIds: vpcPrivateSubnetIds,
  nodeSubnetIds: vpcPrivateSubnetIds,
  nodeAssociatePublicIpAddress: false,
  desiredCapacity: 3,
  maxSize: 3,
  minSize: 3,
  instanceType: "t3a.medium",
  nodePublicKey: sshPublicKey,
  instanceRole: eksWorkerRole,
  deployDashboard: false,
  userMappings: clusterAdmins.map(getClusterAdminMappingByUsername)
});
with that,
pulumi preview
outputs:
Copy code
+ aws:eks/cluster:Cluster: (create)
            [urn=urn:pulumi:test::infrastructure::eks:index:Cluster$aws:eks/cluster:Cluster::test-cluster-eksCluster]
            [provider=urn:pulumi:test::infrastructure::pulumi:providers:aws::default_1_0_0_beta_1::08e235b2-6481-4732-82e5-e9fb91bc1d51]
            name      : "test-cluster-eksCluster-e204193"
b

broad-dog-22463

08/22/2019, 10:58 AM
And it’s not assigning the “test-cluster” name?
d

damp-room-71337

08/22/2019, 10:58 AM
it’s appending
eksCluster-randomID
to the name
b

broad-dog-22463

08/22/2019, 10:59 AM
Is eks.Ckuster your abstraction? I would have expected an aws.eks.Cluster in there
d

damp-room-71337

08/22/2019, 10:59 AM
b

broad-dog-22463

08/22/2019, 11:00 AM
Ah ok so it’s Pulumi/eks
I thought it was Pulumi-aws/eks
Let me look at the eks codebase real quick
d

damp-room-71337

08/22/2019, 11:01 AM
so
eks.Cluster
and
aws.eks.Cluster
are different things?
b

broad-dog-22463

08/22/2019, 11:04 AM
yes
eks is abstraction layer
and I can see, that inside it does this
Copy code
// Create the EKS cluster
    const eksCluster = new aws.eks.Cluster(`${name}-eksCluster`, {
        roleArn: eksRole.apply(r => r.arn),
        vpcConfig: {
            securityGroupIds: [eksClusterSecurityGroup.id],
            subnetIds: subnetIds,
            endpointPrivateAccess: args.endpointPrivateAccess,
            endpointPublicAccess: args.endpointPublicAccess,
        },
        version: args.version,
        enabledClusterLogTypes: args.enabledClusterLogTypes,
    }, {
        parent: parent,
        provider: args.creationRoleProvider ? args.creationRoleProvider.provider : undefined,
    });
notice the
-eksCluster
that's what you are seeing
I guess if you need more fine grained control over the naming, then you might want to use the AWS provider directly?
then you can pass a name to the aws.eks.Cluster
sorry for the confusion here 😞
a

alert-monitor-93874

08/28/2019, 10:31 PM
I have created an issue to suggesting that the name passed to
new eks.Cluster()
is used to name the AWS resource: https://github.com/pulumi/pulumi-eks/issues/240
a

adorable-country-15301

09/23/2019, 8:19 PM
+1 on this would really like to be able to modify name as part of eks.Cluster