Edit: `cluster.eksCluster.name.apply` seems to wo...
# typescript
i
Edit:
cluster.eksCluster.name.apply
seems to work a bit differently than I thought. so basically using it like this seems to work:
Copy code
cluster.eksCluster.name.apply((eksClusterName) => {
  const nodegroup = new eks.NodeGroup(`${name}-nodegroup`, {
    cluster,
    instanceProfile,
    labels: {
      role: 'managed-nodes',
    },
    instanceType: 't2.medium',
    desiredCapacity: 1,
    minSize: 1,
    maxSize: 3,
    autoScalingGroupTags: {
      ['<http://k8s.io/cluster-autoscaler/enabled|k8s.io/cluster-autoscaler/enabled>']: 'true',
      [`<http://k8s.io/cluster-autoscaler/${eksClusterName}`|k8s.io/cluster-autoscaler/${eksClusterName}`>]: 'owned',
    },
  });
------------ Original: Hi! Im trying to setup an eks cluster with k8s cluster autoscaler. To get this to work, I need to tag the nodegroup with:
Copy code
autoScalingGroupTags: {
    ['<http://k8s.io/cluster-autoscaler/enabled|k8s.io/cluster-autoscaler/enabled>']: 'true',
    [`<http://k8s.io/cluster-autoscaler/${cluster.eksCluster.name}`|k8s.io/cluster-autoscaler/${cluster.eksCluster.name}`>]: 'owned',
  },
However, the operation fails since
Template format error: YAML not well-formed
Checking details shows that
cluster.eksCluster.name
is never expanded to the name, instead it becomes:
<http://k8s.io/cluster-autoscaler/Calling|k8s.io/cluster-autoscaler/Calling> [toString] on an [Output<T>] is not supported....
Im creating the cluster with
Copy code
const cluster = new eks.Cluster(name, { optionsĀ });
But the eks cluster dont just get the name
name
, but
${name}-eksCluster-1234567
The number seems to be generated on creation, so I would really need some way of extracting it so I can use it in my tag. I have tried `pulumi.interpolate`k8s.io/cluster-autoscaler/${cluster.eksCluster.name}`` and
Copy code
cluster.eksCluster.name.apply(v => `<http://k8s.io/cluster-autoscaler/${v}`|k8s.io/cluster-autoscaler/${v}`>)
but they both fail with
error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
Any ideas?