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

early-musician-41645

04/10/2019, 12:14 AM
I have a list of custom tags needed by my org to track things per department, cost center, etc
c

colossal-room-15708

04/10/2019, 12:31 AM
Do you mean resources created outside of pulumi?
p

proud-artist-4864

04/10/2019, 4:29 AM
Most AWS Pulumi resources have a tags attribute
b

brave-salesmen-42327

04/10/2019, 2:16 PM
What Ron said. You can see an example for aws ec2 instances: https://pulumi.io/reference/pkg/nodejs/@pulumi/aws/ec2/#Instance
Copy code
const web = new aws.ec2.Instance("web", {
    ami: ubuntu.apply(ubuntu => ubuntu.id),
    instanceType: "t2.micro",
    tags: {
        Name: "HelloWorld",
    },
});
e

early-musician-41645

04/10/2019, 8:16 PM
ah, okay, I missed that earlier. Thanks!
Doesn't seem to work for `eks.Cluster`:
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'.
Can we add tags to EKS resources?
3 Views