Tags don't seem to be available when using `eks.Cl...
# general
e
Tags don't seem to be available when using
eks.Cluster
. I have a need to add tags to the cluster and all related/dependent components, but there's not tags attribute available. Is there any workaround for this?
Copy code
39 /*
 40  * EKS cluster creation
 41  */
 42 export const cluster = new eks.Cluster(config.environment + "-eks-cluster", {
 43     version: config.kubernetesVersion,
 44     vpcId: config.vpcId,
 45     subnetIds: config.subnetIds,
 46     instanceType: config.instanceType,
 47     tags: {
 48       Project: "Mustang",
 49     },
 50     nodeAmiId: config.amiId,
 51     nodePublicKey: config.workerNodePublicKey,
 52     nodeRootVolumeSize: 200,
 53     desiredCapacity: config.desiredNodes,
 54     maxSize: config.maxNumberOfNodes,
 55     minSize: config.minNumberOfNodes,
 56     nodeUserData: userData,
 57     deployDashboard: false,
 58     vpcCniOptions: {



$ pulumi up
Previewing update (redacted):

     Type                 Name                                              Plan     Info
     pulumi:pulumi:Stack  eks-cluster-online-sandbox-vpc           1 error

Diagnostics:
  pulumi:pulumi:Stack (eks-cluster-online-sandbox-vpc):
    error: Running program '/home/tsi/eshamay/git/cs/infrastructure/pulumi/eks-cluster' failed with an unhandled exception:
    TSError: ⨯ Unable to compile TypeScript:
    cluster.ts(47,5): error TS2345: Argument of type '{ version: string; vpcId: string; subnetIds: Output<UnwrappedArray<string>>; instanceType: InstanceType; tags: { Project: string; }; nodeAmiId: string; nodePublicKey: string; nodeRootVolumeSize: number; ... 6 more ...; roleMappings: { ...; }[]; }' is not assignable to parameter of type 'ClusterOptions'.
      Object literal may only specify known properties, and 'tags' does not exist in type 'ClusterOptions'.
i
It looks like the underlying TF provider also doesn’t support tags: https://www.terraform.io/docs/providers/aws/r/eks_cluster.html
e
I thought Pulumi has its own proprietary provider for kubernetes/EKS?
w
The original reported issue is https://github.com/pulumi/pulumi-eks/issues/74. I believe the EKS cluster itself does not support tags, but the instances and many other resources associated with it do, and we can expose the ability to pass tags down to those.
b
It does indeed appear that EKS clusters themselves don't support tagging, based on the AWS API https://docs.aws.amazon.com/sdk-for-go/api/service/eks/#CreateClusterInput and AWS CloudFormation support https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-cluster.html. It appears that, although https://github.com/terraform-aws-modules/terraform-aws-eks accepts tags, it only uses them for the SecurityGroup that it creates. I like Luke's suggestion to accept tags and tag anything we can, possibly even letting you pass specific tags for specific resources (e.g.,
tags
applies to everything it can, whereas
securityGroupTags
only applies to the security group).
Note, Eric, that it looks like this is on deck in our next milestone, which starts Monday after next.
e
👍